Fix error when deleting members
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
95d065345b
commit
7d2b719ca2
3 changed files with 32 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
defmodule MvWeb.MemberLive.IndexTest do
|
||||
use MvWeb.ConnCase, async: true
|
||||
import Phoenix.LiveViewTest
|
||||
require Ash.Query
|
||||
|
||||
test "shows translated title in German", %{conn: conn} do
|
||||
conn = conn_with_oidc_user(conn)
|
||||
|
|
@ -85,4 +86,31 @@ defmodule MvWeb.MemberLive.IndexTest do
|
|||
assert state.socket.assigns.query == "Friedrich"
|
||||
assert is_list(state.socket.assigns.members)
|
||||
end
|
||||
|
||||
test "can delete a member without error", %{conn: conn} do
|
||||
# Create a test member first
|
||||
{:ok, member} =
|
||||
Mv.Membership.create_member(%{
|
||||
first_name: "Test",
|
||||
last_name: "User",
|
||||
email: "test@example.com"
|
||||
})
|
||||
|
||||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, index_view, _html} = live(conn, "/members")
|
||||
|
||||
# Verify the member is displayed
|
||||
assert has_element?(index_view, "#members", "Test User")
|
||||
|
||||
# Click the delete link for this member
|
||||
index_view
|
||||
|> element("a", "Delete")
|
||||
|> render_click()
|
||||
|
||||
# Verify the member is no longer displayed
|
||||
refute has_element?(index_view, "#members", "Test User")
|
||||
|
||||
# Verify the member was actually deleted from the database
|
||||
assert not (Mv.Membership.Member |> Ash.Query.filter(id == ^member.id) |> Ash.exists?())
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue