chore: codify React component style
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user