diff --git a/test/aprsme/shutdown_handler_test.exs b/test/aprsme/shutdown_handler_test.exs index 1dff6e9..9765d72 100644 --- a/test/aprsme/shutdown_handler_test.exs +++ b/test/aprsme/shutdown_handler_test.exs @@ -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 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 new file mode 100644 index 0000000..6f1c760 --- /dev/null +++ b/test/aprsme_web/live/info_live/show_full_render_test.exs @@ -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