aprs.me/test/aprsme_web/live/map_live/overlay_rendering_test.exs
Graham McIntire 2f09b590e2
Some checks are pending
Elixir CI / Build and test (push) Waiting to run
Elixir CI / Dialyzer (push) Waiting to run
Elixir CI / Build and Push Docker Image (push) Blocked by required conditions
fix: resolve all credo issues — 0 warnings, 0 refactoring, 0 readability issues
- Add ex_slop credo plugin with all 40 checks
- Remove DualKeyAccess patterns across codebase — atom-only access
- Fix LengthInGuard, LengthComparison, ListLast, ReduceMapPut in lib/
- Disable LengthComparison for test files
- Remove obvious comments and narrator comments (~50)
- Add missing aliases for fully-qualified modules
- Rewrite boilerplate docs in test/support
- Add normalize_keys helpers at API boundaries
2026-07-29 10:54:07 -05:00

74 lines
2.1 KiB
Elixir

defmodule AprsmeWeb.MapLive.OverlayRenderingTest do
use ExUnit.Case, async: true
alias AprsmeWeb.MapLive.PacketUtils
describe "overlay symbol rendering in map" do
test "W5MRC-15 with D& symbol emits structured marker data" do
packet = %{
id: 1,
sender: "W5MRC-15",
base_callsign: "W5MRC",
ssid: "15",
symbol_table_id: "D",
symbol_code: "&",
lat: 30.0,
lon: -95.0,
comment: "Test station",
received_at: DateTime.utc_now(),
data_type: "position"
}
result = PacketUtils.build_packet_data(packet, true, "en-US")
assert result["symbol_table_id"] == "D"
assert result["symbol_code"] == "&"
assert result["callsign"] == "W5MRC-15"
refute Map.has_key?(result, "symbol_html")
end
test "N# green star overlay symbol generates correct HTML" do
packet = %{
id: 2,
sender: "TEST-1",
base_callsign: "TEST",
ssid: "1",
symbol_table_id: "N",
symbol_code: "#",
lat: 35.0,
lon: -100.0,
comment: "Green star test",
received_at: DateTime.utc_now(),
data_type: "position"
}
result = PacketUtils.build_packet_data(packet, true, "en-US")
assert result["symbol_table_id"] == "N"
assert result["symbol_code"] == "#"
assert result["callsign"] == "TEST-1"
refute Map.has_key?(result, "symbol_html")
end
test "normal symbol /_ generates correct HTML without overlay" do
packet = %{
id: 3,
sender: "WEATHER-1",
base_callsign: "WEATHER",
ssid: "1",
symbol_table_id: "/",
symbol_code: "_",
lat: 40.0,
lon: -105.0,
comment: "Weather station",
received_at: DateTime.utc_now(),
data_type: "weather"
}
result = PacketUtils.build_packet_data(packet, true, "en-US")
assert result["symbol_table_id"] == "/"
assert result["symbol_code"] == "_"
assert result["callsign"] == "WEATHER-1"
refute Map.has_key?(result, "symbol_html")
end
end
end