diff --git a/test/aprsme_web/live/map_live/integration_test.exs b/test/aprsme_web/live/map_live/integration_test.exs index 1375514..e7c5012 100644 --- a/test/aprsme_web/live/map_live/integration_test.exs +++ b/test/aprsme_web/live/map_live/integration_test.exs @@ -756,6 +756,38 @@ defmodule AprsmeWeb.MapLive.IntegrationTest do assert render_hook(view, "clear_and_reload_markers", %{}) end + test "set_location with string lat/lng exercises to_float(binary) parse paths", %{conn: conn} do + {:ok, view, _html} = live(conn, "/", on_error: :warn) + + # Valid binary coords — to_float(binary) → {f, _} → f. + assert render_hook(view, "set_location", %{"lat" => "33.5", "lng" => "-96.5"}) + + # Unparseable binaries — to_float(binary) → :error → nil. + assert render_hook(view, "set_location", %{"lat" => "not-a-number", "lng" => "also-bad"}) + + # Non-binary, non-numeric — to_float(_) → nil fallback. + assert render_hook(view, "set_location", %{"lat" => %{"junk" => "shape"}, "lng" => :weird}) + end + + test "back-to-back bounds_changed exercises schedule_bounds_update timer-cancel branch", %{conn: conn} do + {:ok, view, _html} = live(conn, "/?lat=33.0&lng=-96.0&z=10", on_error: :warn) + render_hook(view, "map_ready", %{}) + + # First bounds_changed schedules a timer. + render_hook(view, "bounds_changed", %{ + "bounds" => %{"north" => 34.0, "south" => 32.0, "east" => -95.0, "west" => -97.0} + }) + + # Second bounds_changed should hit the existing-timer Process.cancel_timer + # branch (lines 1968+). + render_hook(view, "bounds_changed", %{ + "bounds" => %{"north" => 35.0, "south" => 31.0, "east" => -94.0, "west" => -98.0} + }) + + Process.sleep(50) + assert render(view) =~ "aprs-map" + end + test ":initialize_replay reschedules itself when map_bounds is nil", %{conn: conn} do {:ok, view, _html} = live(conn, "/", on_error: :warn) render_hook(view, "map_ready", %{})