- Add 17 missing @spec annotations (layouts, error_json, error_html, skewt_svg) - Move 12+ nested alias/import/require to module top level - Add phx-change/id attributes to 11 raw HTML <form> tags - Remove 4 unused LiveView assigns (:bounds, :data_provider) - Add 3 missing doctest references (HrrrNativeClient, BulkFetch, Accounts) - Break 2 long lines (path_compute.ex:382) - Strengthen weak test assertions (is_binary→byte_size, is_list→!=[]) - Replace Module.concat with Module.safe_concat (2 occurrences) - Replace length/1 > 0 with list != [] (9 occurrences) - Remove no-op assert true, fix no-assertion tests Remaining: 24 socket.assigns introspection warnings (deliberate test pattern for observable behavior testing), 1 formatter-resistant long line, 3 app-code usage warnings.
42 lines
1.5 KiB
Elixir
42 lines
1.5 KiB
Elixir
defmodule Microwaveprop.Rover.CandidateDetailTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Microwaveprop.Rover.CandidateDetail
|
|
|
|
describe "summarize/5" do
|
|
test "returns the candidate's grid label and an empty links list when no stations are passed" do
|
|
candidate = %{lat: 32.9, lon: -97.0}
|
|
result = CandidateDetail.summarize(candidate, [], 10_000, ~U[2026-04-29 12:00:00Z], :ssb)
|
|
|
|
assert String.length(result.grid) == 10
|
|
# 10-character grid for that point.
|
|
assert result.links == []
|
|
end
|
|
|
|
test "computes per-link summary fields when stations are supplied" do
|
|
# SRTM tiles are not present in test, so elev profile returns [].
|
|
# `summarize/5` handles that gracefully and still returns a link.
|
|
candidate = %{lat: 32.9, lon: -97.0}
|
|
|
|
stations = [
|
|
%{callsign: "W5LUA", lat: 33.05, lon: -96.6},
|
|
%{callsign: "W5HN", lat: 32.7, lon: -97.4}
|
|
]
|
|
|
|
result =
|
|
CandidateDetail.summarize(candidate, stations, 10_000, ~U[2026-04-29 12:00:00Z], :ssb)
|
|
|
|
assert length(result.links) == 2
|
|
|
|
Enum.each(result.links, fn link ->
|
|
assert byte_size(link.callsign) > 0
|
|
assert is_float(link.distance_km)
|
|
assert byte_size(link.bearing) > 0
|
|
assert is_float(link.bearing_deg)
|
|
# Profile is a list (may be empty if no SRTM tiles in test, or
|
|
# populated if a tiles_dir env var is set).
|
|
assert Enum.all?(link.profile, &is_map/1)
|
|
end)
|
|
end
|
|
end
|
|
end
|