From dcb759ecfa1ee3e1b7055ba2f725555a155d6720 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 24 Apr 2026 08:59:34 -0500 Subject: [PATCH] test: InfoLive.Show PHG render paths --- .../live/info_live/show_full_render_test.exs | 46 +++++++++++++++++++ 1 file changed, 46 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 0194eed..135a8c0 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,52 @@ defmodule AprsmeWeb.InfoLive.ShowFullRenderTest do assert html =~ "Some comment text" end + test "renders PHG (Power-Height-Gain) data when present", %{conn: conn} do + _packet = + packet_fixture(%{ + sender: "PHG1", + base_callsign: "PHG1", + ssid: "0", + received_at: DateTime.utc_now(), + lat: Decimal.new("33.0"), + lon: Decimal.new("-96.5"), + has_position: true, + data: %{ + "phg_power" => 9, + "phg_height" => 30, + "phg_gain" => 3, + "phg_directivity" => 0 + }, + path: "WIDE1-1" + }) + + {:ok, _lv, html} = live(conn, ~p"/info/PHG1", on_error: :warn) + assert html =~ "PHG1" + # Power-Height-Gain section renders when phg_ fields are present. + assert html =~ "PHG" or html =~ "Power" + end + + test "renders PHG with non-omni directivity", %{conn: conn} do + _packet = + packet_fixture(%{ + sender: "PHG2", + base_callsign: "PHG2", + ssid: "0", + received_at: DateTime.utc_now(), + lat: Decimal.new("33.0"), + lon: Decimal.new("-96.5"), + has_position: true, + data: %{ + "phg_power" => 25, + "phg_directivity" => 90 + }, + path: "" + }) + + {:ok, _lv, html} = live(conn, ~p"/info/PHG2", on_error: :warn) + assert html =~ "PHG2" + end + test "renders heard_by stations section when path has a digipeater", %{conn: conn} do now = DateTime.utc_now()