Functional design, NFR requirements, code generation plan and summary, and build-and-test instructions with results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
Unit Test Execution — frontend-shell
Run the tests
pnpm test # once, with coverage
pnpm test:watch # while developing
Expected results
- 18 test files, 82 tests, 0 failures. That includes:
- Property-based tests (fast-check) for every row in "Testable Properties" of business-rules.md:
backToTopThreshold,visibleSocials,emailAddress,copyrightLine,canonicalUrl,sitemapXml,jsonLdScript,slidesToLoad. - Example-based component tests with React Testing Library.
- axe-core accessibility checks in the component and integration tests (colour contrast excluded in jsdom; Lighthouse covers it).
- Property-based tests (fast-check) for every row in "Testable Properties" of business-rules.md:
- Coverage: the run fails if any pure function in
src/lib/**,src/seo.tsorsrc/sitemap.tsdrops below 100% (statements, branches, functions, lines). For everything else coverage is reported only (overall ≈80% of lines). - Report: in the terminal; an HTML report is written to
coverage/(git-ignored).
Property-based testing (PBT-08)
- Seed: every run prints one line, for example:
The seed comes from
fast-check seed: 1344216500 (opnieuw: FC_SEED=1344216500 pnpm test)config/testSeed.tsand applies to all property tests in that run. - Replay a run exactly, failing or not:
FC_SEED=1344216500 pnpm test - On a failure fast-check also reports the shrunk minimal counterexample and its
path. Shrinking is on and never disabled. - Flaky failures are not retried away. Replay with the seed, find the cause, fix it.
Fixing failing tests
- Read the failing test name and message in the terminal output.
- For a property test: replay with
FC_SEED, then turn the shrunk counterexample into an example test. - Fix the code, or the property if it was stated too broadly. An example from this feature: monotonicity of
backToTopThresholdholds only for finite input, because BR-TOP-01 maps non-finite input to 0. - Rerun
pnpm test.