mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
# 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
27 lines
768 B
TypeScript
27 lines
768 B
TypeScript
import { cleanup, render } from "@testing-library/react";
|
|
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
import { UsernameForm } from "./username-form";
|
|
|
|
vi.mock("next/navigation", () => ({
|
|
useRouter: () => ({ push: vi.fn() }),
|
|
}));
|
|
|
|
vi.mock("next-intl", () => ({
|
|
useTranslations: () => (key: string) => key,
|
|
}));
|
|
|
|
vi.mock("@/lib/server/loginname", () => ({
|
|
sendLoginname: vi.fn(),
|
|
}));
|
|
|
|
describe("UsernameForm", () => {
|
|
afterEach(cleanup);
|
|
|
|
test("should autofocus the loginName input on mount", () => {
|
|
const { getByTestId } = render(
|
|
<UsernameForm loginName="" requestId={undefined} loginSettings={undefined} submit={false} allowRegister={false} />,
|
|
);
|
|
expect(getByTestId("username-text-input")).toHaveFocus();
|
|
});
|
|
});
|