refactor: implement more review comments
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon 2026-01-28 14:47:30 +01:00
parent ea3bdcaa65
commit c3ad8894b0
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
2 changed files with 9 additions and 9 deletions

View file

@ -124,7 +124,8 @@ defmodule MvWeb.UserLive.FormTest do
system_actor = Mv.Helpers.SystemActor.get_system_actor() system_actor = Mv.Helpers.SystemActor.get_system_actor()
updated_user = Ash.reload!(user, domain: Mv.Accounts, actor: system_actor) updated_user = Ash.reload!(user, domain: Mv.Accounts, actor: system_actor)
assert updated_user.hashed_password != original_password assert updated_user.hashed_password != original_password
assert String.starts_with?(updated_user.hashed_password, "$2b$") assert not is_nil(updated_user.hashed_password)
assert updated_user.hashed_password != ""
end end
end end

View file

@ -98,14 +98,12 @@ defmodule MvWeb.UserLive.IndexTest do
|> has_element?() |> has_element?()
# Select second user # Select second user
html = view |> element("input[type='checkbox'][name='#{user2.id}']") |> render_click() view |> element("input[type='checkbox'][name='#{user2.id}']") |> render_click()
# Now select all should be automatically checked (all individual users are selected) # Now select all should be automatically checked (all individual users are selected)
# Note: This test might need adjustment based on actual implementation assert view
# The logic depends on whether authenticated user is included in the count |> element("input[type='checkbox'][name='select_all'][checked]")
assert html =~ "Email" |> has_element?()
assert html =~ to_string(user1.email)
assert html =~ to_string(user2.email)
end end
end end
@ -118,11 +116,12 @@ defmodule MvWeb.UserLive.IndexTest do
# Confirm user is displayed # Confirm user is displayed
assert render(view) =~ "delete-me@example.com" assert render(view) =~ "delete-me@example.com"
# Click the first delete button to test the functionality # Click the delete button (phx-click="delete" event)
view |> element("tbody tr:first-child a[data-confirm]") |> render_click() view |> element("tbody tr:first-child a[data-confirm]") |> render_click()
# The page should still render (basic functionality test) # Verify user was actually deleted (should not appear in HTML anymore)
html = render(view) html = render(view)
refute html =~ "delete-me@example.com"
# Table header should still be there # Table header should still be there
assert html =~ "Email" assert html =~ "Email"
end end