There is no test runner in this repo. pnpm build and pnpm lint are the only automated checks, and neither says anything about behaviour. The header alone now carries real logic — scroll-driven fade, focus management, an inert backdrop, overlay close on history navigation — that is currently only verified by hand.
Split out of #3, which covers wiring these into CI.
Scope
vitest with @vitejs/plugin-react and jsdom (or happy-dom)
@testing-library/react, @testing-library/user-event, @testing-library/jest-dom
- A
pnpm test script, plus test:watch
- Path alias
@/* resolved in the Vitest config so imports match the app
What to cover first
SiteHeader — the overlay opens and closes, Escape closes it, focus moves in on open and back out on close, the backdrop goes inert while open, and the header fade does not strand focus.
ContactForm — submitting builds the expected mailto: and does not navigate.
Marquee / Button — light render assertions.
Known limitation, worth writing down in the config
Async Server Components cannot be unit tested in Vitest or Jest. The Next.js docs say so explicitly and recommend end-to-end tests for those. Most of this app is server components, so unit tests will only reach the "use client" components — site-header.tsx and contact-form.tsx — plus the pure presentational pieces in ui.tsx.
That is an argument for pairing this with Playwright rather than expecting Vitest to cover the routes. Raised separately if wanted.
Toolchain constraint
typescript is pinned to ^6 and eslint to ^9 deliberately — see AGENTS.md under "Toolchain pins". Adding test dependencies must not drag either forward, and pnpm lint must still exit 0 afterwards.
There is no test runner in this repo.
pnpm buildandpnpm lintare the only automated checks, and neither says anything about behaviour. The header alone now carries real logic — scroll-driven fade, focus management, an inert backdrop, overlay close on history navigation — that is currently only verified by hand.Split out of #3, which covers wiring these into CI.
Scope
vitestwith@vitejs/plugin-reactandjsdom(orhappy-dom)@testing-library/react,@testing-library/user-event,@testing-library/jest-dompnpm testscript, plustest:watch@/*resolved in the Vitest config so imports match the appWhat to cover first
SiteHeader— the overlay opens and closes, Escape closes it, focus moves in on open and back out on close, the backdrop goes inert while open, and the header fade does not strand focus.ContactForm— submitting builds the expectedmailto:and does not navigate.Marquee/Button— light render assertions.Known limitation, worth writing down in the config
Async Server Components cannot be unit tested in Vitest or Jest. The Next.js docs say so explicitly and recommend end-to-end tests for those. Most of this app is server components, so unit tests will only reach the
"use client"components —site-header.tsxandcontact-form.tsx— plus the pure presentational pieces inui.tsx.That is an argument for pairing this with Playwright rather than expecting Vitest to cover the routes. Raised separately if wanted.
Toolchain constraint
typescriptis pinned to^6andeslintto^9deliberately — seeAGENTS.mdunder "Toolchain pins". Adding test dependencies must not drag either forward, andpnpm lintmust still exit 0 afterwards.