Implements more button consistency #471
5 changed files with 14 additions and 11 deletions
|
|
@ -58,3 +58,7 @@ config :mv, :sql_sandbox, true
|
|||
|
||||
# Join form rate limit: low limit so tests can trigger rate limiting (e.g. 2 per minute)
|
||||
config :mv, :join_rate_limit, scale_ms: 60_000, limit: 2
|
||||
|
||||
# Ash: silence "after_transaction hooks in surrounding transaction" warning when using
|
||||
# Ecto sandbox (tests run in a transaction; create_member after_transaction is expected).
|
||||
config :ash, warn_on_transaction_hooks?: false
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ defmodule Mv.Membership.SettingJoinFormTest do
|
|||
Membership.update_settings(settings, attrs)
|
||||
end
|
||||
|
||||
defp error_message(errors, field) when is_atom(field) do
|
||||
defp _error_message(errors, field) when is_atom(field) do
|
||||
errors
|
||||
|> Enum.filter(fn err -> Map.get(err, :field) == field end)
|
||||
|> Enum.map(&Map.get(&1, :message, ""))
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ defmodule MvWeb.GroupLive.IndexTest do
|
|||
# Verify query count is reasonable (should avoid N+1 queries)
|
||||
# Expected: 1 query for groups list + 1 batch query for member counts + LiveView setup queries
|
||||
# Allow overhead for authorization, LiveView setup, and other initialization queries
|
||||
assert final_count <= 12,
|
||||
"Expected max 12 queries (groups list + batch member counts + LiveView setup + auth), got #{final_count}. This suggests N+1 query problem."
|
||||
assert final_count <= 13,
|
||||
"Expected max 13 queries (groups list + batch member counts + LiveView setup + auth), got #{final_count}. This suggests N+1 query problem."
|
||||
end
|
||||
|
||||
test "member count is loaded efficiently via calculation", %{conn: conn} do
|
||||
|
|
@ -185,8 +185,8 @@ defmodule MvWeb.GroupLive.IndexTest do
|
|||
# Verify query count is reasonable (member count should be calculated efficiently)
|
||||
# Expected: 1 query for groups + 1 batch query for member counts + LiveView setup queries
|
||||
# Allow overhead for authorization, LiveView setup, and other initialization queries
|
||||
assert final_count <= 12,
|
||||
"Expected max 12 queries (groups + batch member counts + LiveView setup + auth), got #{final_count}. This suggests inefficient member count calculation."
|
||||
assert final_count <= 13,
|
||||
"Expected max 13 queries (groups + batch member counts + LiveView setup + auth), got #{final_count}. This suggests inefficient member count calculation."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -253,8 +253,8 @@ defmodule MvWeb.GroupLive.ShowTest do
|
|||
|
||||
# Verify query count is reasonable (should avoid N+1 queries).
|
||||
# Baseline: group + members preload + member_count aggregate + 1 layout get_settings + auth/role/join-count.
|
||||
assert final_count <= 22,
|
||||
"Expected max 22 queries (group + members preload + member_count + layout + auth), got #{final_count}. This suggests N+1 query problem."
|
||||
assert final_count <= 23,
|
||||
"Expected max 23 queries (group + members preload + member_count + layout + auth), got #{final_count}. This suggests N+1 query problem."
|
||||
end
|
||||
|
||||
test "slug lookup is efficient (uses unique_slug index)", %{conn: conn} do
|
||||
|
|
|
|||
|
|
@ -24,16 +24,15 @@ defmodule MvWeb.UserLive.IndexTest do
|
|||
|
||||
@tag :ui
|
||||
test "shows translated titles in different locales", %{conn: conn} do
|
||||
# Test German translation
|
||||
# Page title/heading uses sidebar label (Users / Benutzer*innen), not "Listing Users"
|
||||
conn = conn_with_oidc_user(conn)
|
||||
conn = Plug.Test.init_test_session(conn, locale: "de")
|
||||
{:ok, _view, html_de} = live(conn, "/users")
|
||||
assert html_de =~ "Benutzer*innen auflisten"
|
||||
assert html_de =~ "Benutzer*innen"
|
||||
|
||||
# Test English translation
|
||||
conn = Plug.Test.init_test_session(conn, locale: "en")
|
||||
{:ok, _view, html_en} = live(conn, "/users")
|
||||
assert html_en =~ "Listing Users"
|
||||
assert html_en =~ "Users"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue