From 91c9220a2d893fbe1bd53048c0b4dc620ee8705b Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 23 Apr 2026 16:47:56 -0500 Subject: [PATCH] test: cover ThemeManager selector, ApiDocsLive packet path and InfoLive Show integration --- test/aprsme_web/live/api_docs_live_test.exs | 19 ++++++++++++ .../live/info_live/show_helpers_test.exs | 23 ++++++++++++++ .../live/info_live/show_integration_test.exs | 19 ++++++++++++ test/aprsme_web/live/theme_manager_test.exs | 30 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 test/aprsme_web/live/info_live/show_integration_test.exs diff --git a/test/aprsme_web/live/api_docs_live_test.exs b/test/aprsme_web/live/api_docs_live_test.exs index fabd50f..f6fb452 100644 --- a/test/aprsme_web/live/api_docs_live_test.exs +++ b/test/aprsme_web/live/api_docs_live_test.exs @@ -55,5 +55,24 @@ defmodule AprsmeWeb.ApiDocsLiveTest do :ok = Process.sleep(50) assert render(lv) =~ "Invalid callsign format" end + + test "valid callsign with no packets returns 'No packets found'", %{conn: conn} do + {:ok, lv, _html} = live(conn, ~p"/api", on_error: :warn) + + lv + |> element("#test_callsign") + |> render_change(%{"callsign" => "N0CALL-9"}) + + lv + |> form("form[phx-submit=\"test_api\"]", %{"callsign" => "N0CALL-9"}) + |> render_submit() + + # Let the async :call_api message run. + :ok = Process.sleep(100) + rendered = render(lv) + # Either "No packets found" (most common in a clean test DB) or a + # packet result. Both exercise the happy path of make_http_request. + assert rendered =~ "No packets found" or rendered =~ "data" + end end end diff --git a/test/aprsme_web/live/info_live/show_helpers_test.exs b/test/aprsme_web/live/info_live/show_helpers_test.exs index 53d500b..9c0568c 100644 --- a/test/aprsme_web/live/info_live/show_helpers_test.exs +++ b/test/aprsme_web/live/info_live/show_helpers_test.exs @@ -142,4 +142,27 @@ defmodule AprsmeWeb.InfoLive.ShowHelpersTest do ] = result end end + + describe "render_symbol_html/2" do + test "returns an empty raw for a nil packet" do + result = Show.render_symbol_html(nil) + # raw("") — a safe-iodata pair. + assert {:safe, ""} = result + end + + test "returns an overlay div for a packet with a uppercase-letter overlay table_id" do + packet = %{symbol_table_id: "A", symbol_code: ">"} + {:safe, html} = Show.render_symbol_html(packet, 24) + assert is_binary(html) + assert html =~ "