test: add InfoLive.Show scenarios for various packet types and broadcasts
This commit is contained in:
parent
ce489101e6
commit
0f4e5234f1
1 changed files with 75 additions and 0 deletions
|
|
@ -66,5 +66,80 @@ defmodule AprsmeWeb.InfoLive.ShowFullRenderTest do
|
|||
{:ok, _lv, html} = live(conn, ~p"/info/MICE1-9", on_error: :warn)
|
||||
assert html =~ "MICE1"
|
||||
end
|
||||
|
||||
test "renders info with an SSID-only path query (e.g., K1ABC-15)", %{conn: conn} do
|
||||
_packet =
|
||||
packet_fixture(%{
|
||||
sender: "K1ABC-15",
|
||||
base_callsign: "K1ABC",
|
||||
ssid: "15",
|
||||
received_at: DateTime.utc_now(),
|
||||
lat: Decimal.new("42.0"),
|
||||
lon: Decimal.new("-72.0"),
|
||||
has_position: true,
|
||||
path: "WIDE1-1,WIDE2-1,qAO,K5XYZ*"
|
||||
})
|
||||
|
||||
{:ok, _lv, html} = live(conn, ~p"/info/K1ABC-15", on_error: :warn)
|
||||
assert html =~ "K1ABC-15"
|
||||
end
|
||||
|
||||
test "renders info for a station with a weather-only packet", %{conn: conn} do
|
||||
_packet =
|
||||
packet_fixture(%{
|
||||
sender: "WXONLY",
|
||||
base_callsign: "WXONLY",
|
||||
ssid: "0",
|
||||
received_at: DateTime.utc_now(),
|
||||
lat: Decimal.new("38.0"),
|
||||
lon: Decimal.new("-77.0"),
|
||||
has_position: true,
|
||||
has_weather: true,
|
||||
data_type: "weather",
|
||||
temperature: 68.0,
|
||||
humidity: 80.0,
|
||||
pressure: 1010.0,
|
||||
wind_speed: 3.0,
|
||||
wind_direction: 270,
|
||||
wind_gust: 5.0,
|
||||
rain_1h: 0.0,
|
||||
rain_24h: 0.5,
|
||||
rain_since_midnight: 0.3
|
||||
})
|
||||
|
||||
{:ok, _lv, html} = live(conn, ~p"/info/WXONLY", on_error: :warn)
|
||||
assert html =~ "WXONLY"
|
||||
end
|
||||
|
||||
test "posts a postgres_packet broadcast to InfoLive.Show without crashing", %{conn: conn} do
|
||||
_packet =
|
||||
packet_fixture(%{
|
||||
sender: "BC1",
|
||||
base_callsign: "BC1",
|
||||
ssid: "0",
|
||||
received_at: DateTime.utc_now(),
|
||||
lat: Decimal.new("33.0"),
|
||||
lon: Decimal.new("-96.5"),
|
||||
has_position: true,
|
||||
path: "WIDE1-1"
|
||||
})
|
||||
|
||||
{:ok, lv, _html} = live(conn, ~p"/info/BC1", on_error: :warn)
|
||||
|
||||
broadcast_payload = %{
|
||||
sender: "BC1",
|
||||
base_callsign: "BC1",
|
||||
ssid: "0",
|
||||
lat: 33.1,
|
||||
lon: -96.6,
|
||||
received_at: DateTime.utc_now(),
|
||||
has_position: true,
|
||||
path: "WIDE1-1"
|
||||
}
|
||||
|
||||
send(lv.pid, {:postgres_packet, broadcast_payload})
|
||||
Process.sleep(50)
|
||||
assert render(lv) =~ "BC1"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue