test: add MapLive.Index URL param and callsign route tests
This commit is contained in:
parent
adb304e069
commit
b4d0093a8f
1 changed files with 35 additions and 0 deletions
|
|
@ -410,4 +410,39 @@ defmodule AprsmeWeb.MapLive.IndexTest do
|
|||
assert render(view) =~ "aprs-map"
|
||||
end
|
||||
end
|
||||
|
||||
describe "MapLive.Index with URL params" do
|
||||
test "mounts with lat/lng/z URL params", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, "/?lat=40.5&lng=-98.5&z=10", on_error: :warn)
|
||||
assert html =~ "aprs-map"
|
||||
end
|
||||
|
||||
test "mounts with a callsign URL param", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, "/?call=K1ABC", on_error: :warn)
|
||||
assert html =~ "aprs-map"
|
||||
end
|
||||
|
||||
test "mounts with a trail duration URL param", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, "/?trail=3", on_error: :warn)
|
||||
assert html =~ "aprs-map"
|
||||
end
|
||||
|
||||
test "mounts with a historical hours URL param", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, "/?hist=6", on_error: :warn)
|
||||
assert html =~ "aprs-map"
|
||||
end
|
||||
|
||||
test "handles patch with updated params via handle_params", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
# Patch to the same LiveView with new params — triggers handle_params.
|
||||
assert render_patch(view, "/?trail=2&hist=2&lat=41.0&lng=-97.0&z=8") =~ "aprs-map"
|
||||
end
|
||||
end
|
||||
|
||||
describe "MapLive.Index callsign-based routes" do
|
||||
test "mounts with /:callsign path", %{conn: conn} do
|
||||
{:ok, _view, html} = live(conn, "/K5ABC", on_error: :warn)
|
||||
assert html =~ "K5ABC" or html =~ "aprs-map"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue