Some checks failed
Build and Push / Build and Push Docker Image (push) Failing after 2s
80 lines
2.3 KiB
Elixir
80 lines
2.3 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
|
|
# Create a test packet with overlay symbol D&
|
|
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"
|
|
}
|
|
|
|
# Process the packet through PacketUtils
|
|
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
|
|
# Create a test packet with overlay symbol N#
|
|
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"
|
|
}
|
|
|
|
# Process the packet
|
|
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
|
|
# Create a test packet with normal symbol /_
|
|
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"
|
|
}
|
|
|
|
# Process the packet
|
|
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
|