test: adapt tests to reflect implementation details
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon 2026-01-27 23:40:12 +01:00
parent 5e0b6580ae
commit 9991291b2f
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
7 changed files with 98 additions and 71 deletions

View file

@ -41,20 +41,22 @@ defmodule MvWeb.GroupLive.IndexTest do
assert html =~ "Test Group"
assert html =~ "Test description"
# Member count should be displayed (0 for empty group)
assert html =~ "0" || html =~ gettext("Members")
assert html =~ "0" or html =~ gettext("Members") or html =~ "Mitglieder"
end
test "displays 'Create Group' button for admin users", %{conn: conn} do
{:ok, _view, html} = live(conn, "/groups")
assert html =~ gettext("Create Group") || html =~ "create" || html =~ "new"
assert html =~ gettext("Create Group") or html =~ "create" or html =~ "new" or
html =~ "Gruppe erstellen"
end
test "displays empty state when no groups exist", %{conn: conn} do
{:ok, _view, html} = live(conn, "/groups")
# Should show empty state or empty list message
assert html =~ gettext("No groups") || html =~ "0" || html =~ "empty"
assert html =~ gettext("No groups") or html =~ "0" or html =~ "empty" or
html =~ "Keine Gruppen"
end
end
@ -74,7 +76,7 @@ defmodule MvWeb.GroupLive.IndexTest do
{:ok, _view, html} = live(conn, "/groups")
assert html =~ long_description || html =~ String.slice(long_description, 0, 100)
assert html =~ long_description or html =~ String.slice(long_description, 0, 100)
end
end
@ -92,8 +94,8 @@ defmodule MvWeb.GroupLive.IndexTest do
test "unauthenticated users are redirected to login", %{conn: conn} do
result = live(conn, "/groups")
assert match?({:error, {:redirect, %{to: "/auth/sign_in"}}}, result) ||
match?({:error, {:live_redirect, %{to: "/auth/sign_in"}}}, result)
assert match?({:error, {:redirect, %{to: "/sign-in"}}}, result) ||
match?({:error, {:live_redirect, %{to: "/sign-in"}}}, result)
end
@tag role: :member
@ -108,7 +110,7 @@ defmodule MvWeb.GroupLive.IndexTest do
assert html =~ gettext("Groups")
# Should NOT see create button
refute html =~ gettext("Create Group") || html =~ "create"
refute html =~ gettext("Create Group") or html =~ "create"
end
end
@ -143,7 +145,7 @@ defmodule MvWeb.GroupLive.IndexTest do
{:ok, _view, html} = live(conn, "/groups")
# Member count should be displayed (should be 2)
assert html =~ "2" || html =~ gettext("Members")
assert html =~ "2" or html =~ gettext("Members") or html =~ "Mitglieder"
end
end
end