fix tests
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
carla 2026-01-13 10:48:44 +01:00
parent 720a43a38c
commit 35895ac7fd
3 changed files with 28 additions and 157 deletions

View file

@ -7,13 +7,13 @@ defmodule MvWeb.MemberLive.ShowTest do
- Custom Fields section visibility (Issue #282 regression test)
- Custom field values formatting
## Note on async: false
Tests use `async: false` (not `async: true`) to prevent PostgreSQL deadlocks
when creating members and custom fields concurrently. This is intentional and
documented here to avoid confusion in commit messages.
## Note on async
Tests can run with `async: true` because:
- Each test explicitly manages its own custom fields (creates/deletes as needed)
- The SQL Sandbox provides proper isolation between parallel tests
- Custom field cleanup in tests ensures no interference between tests
"""
# async: false to prevent PostgreSQL deadlocks when creating members and custom fields
use MvWeb.ConnCase, async: false
use MvWeb.ConnCase, async: true
import Phoenix.LiveViewTest
require Ash.Query
use Gettext, backend: MvWeb.Gettext
@ -113,11 +113,21 @@ defmodule MvWeb.MemberLive.ShowTest do
conn: conn,
member: member
} do
# Ensure no custom fields exist for this test
# This ensures test isolation even if previous tests created custom fields
existing_custom_fields = Ash.read!(CustomField)
for cf <- existing_custom_fields do
Ash.destroy!(cf)
end
# Verify no custom fields exist
assert Ash.read!(CustomField) == []
conn = conn_with_oidc_user(conn)
{:ok, _view, html} = live(conn, ~p"/members/#{member}")
# Custom Fields section should NOT be visible
refute html =~ gettext("Custom Fields")
refute html =~ gettext("Additional Data Fields")
end
end