test: InfoLive.Show weather link + no-packet branches

This commit is contained in:
Graham McIntire 2026-04-24 09:07:27 -05:00
parent f421cf7b13
commit 4875904303
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -256,6 +256,34 @@ defmodule AprsmeWeb.InfoLive.ShowFullRenderTest do
assert html =~ "Some comment text"
end
test "renders 'Weather charts' link when station has weather packets", %{conn: conn} do
_packet =
packet_fixture(%{
sender: "WXLINK",
base_callsign: "WXLINK",
ssid: "0",
received_at: DateTime.utc_now(),
lat: Decimal.new("33.0"),
lon: Decimal.new("-96.5"),
has_position: true,
has_weather: true,
temperature: 72.0,
humidity: 50.0,
path: ""
})
{:ok, _lv, html} = live(conn, ~p"/info/WXLINK", on_error: :warn)
# The Weather charts link should be rendered since has_weather_packets? = true.
assert html =~ "Weather" or html =~ "weather"
end
test "renders 'no packets' branch when no packet exists", %{conn: conn} do
# Callsign with no packets in DB.
{:ok, _lv, html} = live(conn, ~p"/info/NOPACKET1", on_error: :warn)
assert html =~ "NOPACKET1"
# The 'if @packet do' branch falls through to the empty-state.
end
test "renders PHG (Power-Height-Gain) data when present", %{conn: conn} do
_packet =
packet_fixture(%{