fix(auth): remove character context dependency

This commit is contained in:
2026-07-20 10:42:40 +08:00
parent 7bd5defa5e
commit 16b5c16e76
3 changed files with 15 additions and 10 deletions
@@ -1,6 +1,7 @@
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
import { AuthScreen } from "../../auth-screen";
import { AuthBackground } from "../auth-background";
import { AuthEmailPanel } from "../auth-email-panel";
import { AuthErrorMessage } from "../auth-error-message";
@@ -24,11 +25,15 @@ vi.mock("@/stores/auth/auth-context", () => ({
}),
}));
vi.mock("@/router/use-app-navigator", () => ({
useAppNavigator: () => ({ back: vi.fn() }),
vi.mock("next/navigation", () => ({
useRouter: () => ({ back: vi.fn(), replace: vi.fn() }),
}));
describe("auth Tailwind components", () => {
it("renders outside CharacterProvider", () => {
expect(() => renderToStaticMarkup(<AuthScreen />)).not.toThrow();
});
it("renders AuthErrorMessage only when a message is present", () => {
expect(renderToStaticMarkup(<AuthErrorMessage message={null} />)).toBe("");