Some checks failed
Build and Push / Build and Push Docker Image (push) Failing after 4m38s
- F-level (228): replace length/1 with Enum.count_until/2 or pattern matching; convert Enum.flat_map+if to Enum.filter+Enum.map; fix identity case in narr_client - W-level (46): normalize dual atom/string key access in weather_layers, beacon_measurements, surface, skewt_live, contact_live/show; add :data_provider and weather-map assigns to ignored_assigns in credo config (consumed by child components credo can't trace); remove weak is_list assertion; remove explicit assert_receive timeout - R-level (6): replace 'This module provides...' moduledocs with meaningful descriptions - Also fix 4 compile-connected xref issues by deferring BandConfig.band_options() from module attribute to runtime Co-Authored-By: Claude <noreply@anthropic.com>
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 Enum.count_until(result.links, 3) == 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
|