Adds the footer, back-to-top button, skip link, placeholder routes, 404 and error pages inside the shell, plus per-page SEO from a single page registry (canonical URLs, Open Graph image, JSON-LD, generated sitemap.xml and robots.txt). Theme tokens and recipes replace repeated styling, the hero loads only the active and neighbouring slides, and the e-mail address is joined in the browser to keep it out of the HTML and bundle. Adds Vitest with property-based (fast-check) and axe tests, ESLint, security headers for dev and preview, Lighthouse CI and a `pnpm check` script that runs all quality gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
import { ChakraProvider } from '@chakra-ui/react';
|
|
import {
|
|
createMemoryHistory,
|
|
createRootRoute,
|
|
createRoute,
|
|
createRouter,
|
|
RouterProvider,
|
|
} from '@tanstack/react-router';
|
|
import { render } from '@testing-library/react';
|
|
import system from '../theme';
|
|
|
|
// Rendert een component binnen het Chakra-thema en een router op `path`.
|
|
// Een splat-route vangt elk pad op, zodat links en aria-current werken
|
|
// zonder de echte route tree.
|
|
export async function renderWithProviders(ui: ReactNode, { path = '/' } = {}) {
|
|
const rootRoute = createRootRoute({ component: () => <>{ui}</> });
|
|
const splat = createRoute({ getParentRoute: () => rootRoute, path: '$' });
|
|
const router = createRouter({
|
|
routeTree: rootRoute.addChildren([splat]),
|
|
history: createMemoryHistory({ initialEntries: [path] }),
|
|
});
|
|
await router.load();
|
|
|
|
const result = render(
|
|
<ChakraProvider value={system}>
|
|
<RouterProvider router={router} />
|
|
</ChakraProvider>,
|
|
);
|
|
return { ...result, router };
|
|
}
|