chore: codify React component style

This commit is contained in:
2026-08-25 15:33:20 +03:00
parent 268acdf2e1
commit d10e1dd182
65 changed files with 711 additions and 365 deletions
+11 -6
View File
@@ -1,5 +1,6 @@
import { MantineProvider } from "@mantine/core";
import { cleanup, render, screen, waitFor } from "@testing-library/react";
import type { FC } from "react";
import { MemoryRouter, useLocation, useNavigate } from "react-router";
import { afterEach, describe, expect, it, vi } from "vitest";
import { RouteErrorBoundary } from "./RouteErrorBoundary";
@@ -9,10 +10,11 @@ vi.mock("@/features/auth", () => ({
useAuth: () => ({ user: authenticated ? {} : null }),
}));
function ThrowingRoute(): never {
const ThrowingRoute: FC = () => {
throw new Error("test route failure");
}
function HealthyRoute() {
};
const HealthyRoute: FC = () => {
return (
<div>
{useLocation().pathname === "/healthy" ? (
@@ -22,9 +24,11 @@ function HealthyRoute() {
)}
</div>
);
}
function RouteHarness() {
};
const RouteHarness: FC = () => {
const navigate = useNavigate();
return (
<>
<button type="button" onClick={() => navigate("/healthy")}>
@@ -35,7 +39,8 @@ function RouteHarness() {
</RouteErrorBoundary>
</>
);
}
};
function renderBoundary(path: string) {
return render(
<MantineProvider>