refactor: colocate frontend component files
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Successful in 5m10s
Conventional commits / commits (pull_request) Successful in 25s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 5m10s

This commit is contained in:
2026-09-23 08:34:58 +03:00
parent 85fcfe3d07
commit b987fd8e78
190 changed files with 131 additions and 108 deletions
@@ -0,0 +1,34 @@
import { MantineProvider } from "@mantine/core";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { MemoryRouter } from "react-router";
import { describe, expect, it, vi } from "vitest";
import { AuthForm } from "./AuthForm";
describe("AuthForm", () => {
it("does not submit registration when password confirmation differs", async () => {
const onSubmit = vi.fn();
render(
<MantineProvider>
<MemoryRouter>
<AuthForm register onSubmit={onSubmit} />
</MemoryRouter>
</MantineProvider>,
);
fireEvent.change(screen.getByLabelText("Email"), {
target: { value: "user@example.com" },
});
fireEvent.change(screen.getByLabelText("Пароль"), {
target: { value: "a secure password" },
});
fireEvent.change(screen.getByLabelText("Подтвердите пароль"), {
target: { value: "another secure password" },
});
fireEvent.click(screen.getByRole("button", { name: "Регистрация" }));
await waitFor(() => expect(onSubmit).not.toHaveBeenCalled());
await waitFor(() =>
expect(screen.getByText("Пароли не совпадают")).toBeInTheDocument(),
);
});
});