test: account activity request_path + data_accessed render branches

This commit is contained in:
Graham McIntire 2026-05-09 09:28:18 -05:00
parent b51759dfdf
commit 5498dc6961

View file

@ -173,5 +173,31 @@ defmodule ToweropsWeb.AccountLive.ActivityTest do
{:ok, _view, html} = live(conn, ~p"/account/activity")
assert html =~ "Monitoring data queried"
end
test "renders request_path when present", %{conn: conn, user: user} do
{:ok, _} =
Admin.create_audit_log(%{
action: "user_profile_updated",
superuser_id: user.id,
target_user_id: user.id,
request_path: "/account/profile/edit"
})
{:ok, _view, html} = live(conn, ~p"/account/activity")
assert html =~ "/account/profile/edit"
end
test "renders data_accessed map when present", %{conn: conn, user: user} do
{:ok, _} =
Admin.create_audit_log(%{
action: "user_data_exported",
superuser_id: user.id,
target_user_id: user.id,
data_accessed: %{"profile" => "viewed", "sessions" => "listed"}
})
{:ok, _view, html} = live(conn, ~p"/account/activity")
assert html =~ "Data accessed"
end
end
end