From 4875904303ba6ebc393b46b168a73b7b16b5ad30 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 24 Apr 2026 09:07:27 -0500 Subject: [PATCH] test: InfoLive.Show weather link + no-packet branches --- .../live/info_live/show_full_render_test.exs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/aprsme_web/live/info_live/show_full_render_test.exs b/test/aprsme_web/live/info_live/show_full_render_test.exs index 135a8c0..be0ec47 100644 --- a/test/aprsme_web/live/info_live/show_full_render_test.exs +++ b/test/aprsme_web/live/info_live/show_full_render_test.exs @@ -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(%{