test: info_live full render with various packet types

This commit is contained in:
Graham McIntire 2026-04-23 17:11:45 -05:00
parent 32d4b6daff
commit 30d852fbc5
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 79 additions and 0 deletions

View file

@ -114,4 +114,13 @@ defmodule Aprsme.ShutdownHandlerTest do
assert :ok = ShutdownHandler.terminate(:crash, state)
end
end
describe "shutdown/0 as an external API" do
test "returns the call result if the GenServer is up, else raises" do
# Starting the shutdown handler would actually shut down the test VM.
# We just verify the module function exists and dispatches to the server.
assert function_exported?(ShutdownHandler, :shutdown, 0)
assert function_exported?(ShutdownHandler, :shutting_down?, 0)
end
end
end

View file

@ -0,0 +1,70 @@
defmodule AprsmeWeb.InfoLive.ShowFullRenderTest do
use AprsmeWeb.ConnCase
import Aprsme.PacketsFixtures
import Phoenix.LiveViewTest
@moduletag :capture_log
describe "InfoLive.Show with real packet data" do
test "renders full station info for a callsign with a position packet", %{conn: conn} do
_packet =
packet_fixture(%{
sender: "INFO1",
base_callsign: "INFO1",
ssid: "0",
received_at: DateTime.utc_now(),
lat: Decimal.new("33.0"),
lon: Decimal.new("-96.5"),
has_position: true,
path: "WIDE1-1,qAC,T2TEXAS",
data_type: "position"
})
{:ok, _lv, html} = live(conn, ~p"/info/INFO1", on_error: :warn)
assert html =~ "INFO1"
end
test "renders info with a weather packet", %{conn: conn} do
_packet =
packet_fixture(%{
sender: "INFO2",
base_callsign: "INFO2",
ssid: "0",
received_at: DateTime.utc_now(),
lat: Decimal.new("40.7"),
lon: Decimal.new("-74.0"),
has_position: true,
temperature: 72.5,
humidity: 50,
pressure: 1013.2,
path: "qAC,T2NY"
})
{:ok, _lv, html} = live(conn, ~p"/info/INFO2", on_error: :warn)
assert html =~ "INFO2"
end
test "renders info with a mic-e data_extended packet", %{conn: conn} do
_packet =
packet_fixture(%{
sender: "MICE1",
base_callsign: "MICE1",
ssid: "9",
received_at: DateTime.utc_now(),
lat: Decimal.new("35.0"),
lon: Decimal.new("-90.0"),
has_position: true,
data_type: "mic_e",
course: 45,
speed: 10.5,
altitude: 100.0,
path: "WIDE1-1"
})
{:ok, _lv, html} = live(conn, ~p"/info/MICE1-9", on_error: :warn)
assert html =~ "MICE1"
end
end
end