My Reps tests are organized around seams. Each seam has a small public contract and focused tests.
Files:
src/core/validation.test.tssrc/core/lookup.test.tssrc/core/openStatesSource.test.ts
These tests cover input validation, mock lookup behavior, live source behavior, coverage metadata, source error mapping, and privacy guarantees. Most behavior changes should start here.
Run a core test file:
npx vitest run src/core/lookup.test.tsFile:
src/api/lookup.test.ts
These tests cover HTTP request parsing, method handling, status code mapping, live env wiring, API headers, and sanitized failures.
The API should stay thin. If an API test needs a lot of domain setup, that usually means the behavior belongs in src/core.
Run it:
npx vitest run src/api/lookup.test.tsFile:
src/cli/georep.test.ts
These tests cover command parsing, JSON output, exit codes, schema, source-status, and privacy behavior from the terminal surface.
Run it:
npx vitest run src/cli/georep.test.tsFile:
src/web/App.test.tsx
These tests cover the browser-facing states without starting Cloudflare: success, validation errors, no results, partial coverage, source failures, transport failures, and basic interaction behavior.
Run it:
npx vitest run src/web/App.test.tsxFiles:
scripts/smoke-lookup.mjsscripts/smoke-lookup.test.mjs
The smoke script checks a running deployment or preview by posting to /api/lookup and verifying the envelope shape.
Run against a local preview:
npm run pages:preview
npm run smoke:lookup -- http://127.0.0.1:8788Files:
tests/e2e/public-demo.spec.tsplaywright.config.ts
The e2e suite starts the Cloudflare Pages-style preview in mock mode and checks the public demo path in Chromium.
Run it:
npm run test:e2eIf Chromium cannot launch, install Playwright dependencies:
npx playwright install --with-deps chromiumProduction dependency audit:
npm audit --omit=devFull dev audit:
npm auditThe full dev audit currently reports moderate Vite/Vitest toolchain advisories that require major upgrades. Production dependencies audit cleanly.