Files
zitadel/apps/login/src/components/change-password-form.test.tsx
T
RamonandGitHub 057fb8dff2 fix(login): prettier setup (#11798)
# Which Problems Are Solved
Invalid formatting in the login codebase due to invalid prettier
configuration

# How the Problems Are Solved
Fxed .prettierignore wildcards for login source files

# Additional Changes
Removed .prettierrc file because there is already a prettier.config.mjs
file

# Additional Context
2026-03-10 13:30:20 +00:00

46 lines
1.3 KiB
TypeScript

import { cleanup, render } from "@testing-library/react";
import { create } from "@zitadel/client";
import { PasswordComplexitySettingsSchema } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
import { afterEach, describe, expect, test, vi } from "vitest";
import { ChangePasswordForm } from "./change-password-form";
vi.mock("next/navigation", () => ({
useRouter: () => ({ push: vi.fn() }),
}));
vi.mock("next-intl", () => ({
useTranslations: () => (key: string) => key,
}));
vi.mock("@/lib/server/password", () => ({
checkSessionAndSetPassword: vi.fn(),
sendPassword: vi.fn(),
}));
vi.mock("@/lib/client", () => ({
handleServerActionResponse: vi.fn(),
}));
const defaultComplexitySettings = create(PasswordComplexitySettingsSchema, {
minLength: 8n,
requiresUppercase: false,
requiresLowercase: false,
requiresNumber: false,
requiresSymbol: false,
});
describe("ChangePasswordForm", () => {
afterEach(cleanup);
test("should autofocus the current password input on mount", () => {
const { getByTestId } = render(
<ChangePasswordForm
passwordComplexitySettings={defaultComplexitySettings}
sessionId="session-1"
loginName="[email protected]"
/>,
);
expect(getByTestId("password-change-current-text-input")).toHaveFocus();
});
});