- Fix doctests for Accounts, Agents.Stats, Snmp to match actual behavior - Fix dynamic_extra_test vendor post-processing tests to seed sensor data - Fix activity_controller_test to seed devices for feed data - Fix session_manager_test to create browser session for test - Fix topology_test link creation for connection test - Fix device_monitor/driver_worker tests for unique job constraints - Fix accounts_test expired_tokens assertion (magic link token is expired) - Fix happy_path_test and show_events_test to seed monitor data - Fix admin user_live_test user.name -> user.email (no name field) - Fix schema_test to seed activity data - Fix mobile_qr_live_test to match actual template text - Fix SnmpKit.MIB doctests and tests for enriched return values - Fix onboarding_live, mobile_controller, mib_test weak assertions - Remove dead code and fix credo warnings
35 lines
1.1 KiB
Elixir
35 lines
1.1 KiB
Elixir
defmodule ToweropsWeb.MapLive.IndexEventsTest do
|
|
@moduledoc "Drives MapLive.Index event handlers."
|
|
use ToweropsWeb.ConnCase, async: true
|
|
|
|
import Phoenix.LiveViewTest
|
|
|
|
setup :register_and_log_in_user
|
|
|
|
setup %{user: user} do
|
|
{:ok, organization} = Towerops.Organizations.create_organization(%{name: "Map Org"}, user.id)
|
|
%{organization: organization}
|
|
end
|
|
|
|
describe "map event handlers" do
|
|
test "site_clicked navigates to site detail", %{conn: conn, organization: org} do
|
|
{:ok, site} =
|
|
Towerops.Sites.create_site(%{
|
|
name: "Smoke Site",
|
|
organization_id: org.id,
|
|
latitude: 30.0,
|
|
longitude: -97.0
|
|
})
|
|
|
|
{:ok, view, _html} = live(conn, ~p"/sites-map")
|
|
result = render_hook(view, "site_clicked", %{"site_id" => site.id})
|
|
assert match?({:error, {:live_redirect, %{to: _}}}, result)
|
|
end
|
|
|
|
test "refresh_map shows flash and reloads", %{conn: conn} do
|
|
{:ok, view, _html} = live(conn, ~p"/sites-map")
|
|
_ = render_hook(view, "refresh_map", %{})
|
|
assert Process.alive?(view.pid)
|
|
end
|
|
end
|
|
end
|