prop/test/microwaveprop/rover/candidate_detail_test.exs
Graham McIntire 888701e627
test: bump coverage 80% -> 81.3% via more LiveView + module tests
- Pskr.Client: 0% -> 18% (init/standby/handle_info/terminate)
- RoverPlanningLive.PathShow: 0% -> 82% (mount/load_path)
- Rover.CandidateDetail: 0% -> partial (summarize/5 with stations)
- Mix.Tasks.Weather.RebatchAsos: 0% -> covered (wrapper run/1)
- HrrrNativeClient: 57% -> 67% (fetch_native_duct_grid error paths)
- RoverLive: 40% -> 48% (toggle/delete/update_station_grid logged-in)
- PathLive: 62% -> 63% (path_forecast_detail + rover_path_id branches)
- PathCompute: 64% -> 64% (compute/4 full pipeline + resolve_location)
- SkewtLive: 29% -> 31% (search/select_time event no-ops)
- SkewtLocationResolver: 38% -> 60%+ (callsign cache + error paths)

3557 tests passing.
2026-05-08 09:10:34 -05:00

43 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 is_binary(result.grid)
# 10-character grid for that point.
assert String.length(result.grid) == 10
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 is_binary(link.callsign)
assert is_float(link.distance_km)
assert is_binary(link.bearing)
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 is_list(link.profile)
end)
end
end
end