From 5498dc6961f321d08e953183fe0b2a14b8815262 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 9 May 2026 09:28:18 -0500 Subject: [PATCH] test: account activity request_path + data_accessed render branches --- .../live/account_live/activity_test.exs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/towerops_web/live/account_live/activity_test.exs b/test/towerops_web/live/account_live/activity_test.exs index b8789667..2810bc8b 100644 --- a/test/towerops_web/live/account_live/activity_test.exs +++ b/test/towerops_web/live/account_live/activity_test.exs @@ -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