Secure Sakani portal and show full album titles

This commit is contained in:
Leon Tonhäuser committed 2026-11-30 19:14:57 +01:00
1 parent c40ccf77cf
commit 69264ce165
49 files changed
+1362 -601

No files matched your search

+20
View File
@@ -12,6 +12,7 @@ vi.mock("next/navigation", () => ({
vi.mock("next-themes", () => ({ useTheme: () => ({ resolvedTheme: "light", setTheme: vi.fn() }) }));
vi.mock("@/modules/auth/client", () => ({ authClient: { signOut: vi.fn() } }));
import { authClient } from "@/modules/auth/client";
import { AppShell } from "./app-shell";
import { RELEASE } from "./release-notes";
@@ -74,3 +75,22 @@ test("release notes pop up once per version and reopen from the sidebar", async
fireEvent.click(screen.getByRole("button", { name: new RegExp(`Was ist neu · v${RELEASE.version}`) }));
expect(await screen.findByRole("dialog", { name: "Was ist neu?" })).toBeTruthy();
});
test.each(["rejected", "error response"])("failed sign-out (%s) stays on the page and can be retried", async (kind) => {
const signOut = vi.mocked(authClient.signOut);
const error = { error: { status: 503, statusText: "Unavailable" }, data: null };
signOut.mockReset();
if (kind === "rejected") signOut.mockRejectedValueOnce(new Error("network failure"));
else signOut.mockResolvedValueOnce(error);
signOut.mockResolvedValueOnce(error);
render(<AppShell area="redaktion" legal={legal}>Inhalt</AppShell>);
fireEvent.click(screen.getByRole("button", { name: "Abmelden" }));
expect((await screen.findByRole("alert")).textContent).toMatch(/fehlgeschlagen/i);
expect(screen.getByText("Inhalt")).toBeTruthy();
const retry = screen.getByRole("button", { name: "Abmelden" });
expect((retry as HTMLButtonElement).disabled).toBe(false);
fireEvent.click(retry);
expect(signOut).toHaveBeenCalledTimes(2);
await screen.findByRole("alert");
});