aprs.me/test/aprsme_web/live/map_live/callsign_view_test.exs
Graham McIntire 2584fdf87b
fix: Update tests and normalize callsigns for new URL structure
- Update callsign view tests to use LiveView instead of redirect assertions
- Normalize callsigns to uppercase when extracting from path params
- Handle empty/nil callsigns gracefully in mount function
- Tests now verify map display rather than redirect behavior

All tests now pass with the new direct station URL implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 13:09:24 -05:00

32 lines
1 KiB
Elixir

defmodule AprsmeWeb.MapLive.CallsignViewTest do
use AprsmeWeb.ConnCase
import Phoenix.LiveViewTest
describe "CallsignView displays map for callsign" do
test "displays map with callsign in path", %{conn: conn} do
{:ok, view, _html} = live(conn, "/W5ISP-9")
assert has_element?(view, "#aprs-map")
assert render(view) =~ "W5ISP-9"
end
test "handles lowercase callsigns", %{conn: conn} do
{:ok, view, _html} = live(conn, "/w5isp-9")
assert has_element?(view, "#aprs-map")
# Callsigns are normalized to uppercase
assert render(view) =~ "W5ISP-9"
end
test "handles callsign without SSID", %{conn: conn} do
{:ok, view, _html} = live(conn, "/W5ISP")
assert has_element?(view, "#aprs-map")
assert render(view) =~ "W5ISP"
end
test "handles special characters in callsign", %{conn: conn} do
{:ok, view, _html} = live(conn, "/TEST-123")
assert has_element?(view, "#aprs-map")
assert render(view) =~ "TEST-123"
end
end
end