Testing Strategy
Tests live with each independently deployable repository. There is no single root command that validates every AceSense surface, so CI and release checks must call each repository's declared scripts.
Required gates by repositoryโ
| Repository | Commands |
|---|---|
| Flutter app | dart format --output=none --set-exit-if-changed lib test, flutter analyze, flutter test |
| Auth/functions | pnpm lint, pnpm build, pnpm test |
| Firestore/Storage rules | npm run test:rules:emulator in acesense-frontend |
| Admin | pnpm lint, pnpm test, pnpm build; pnpm test:e2e for UI journeys |
| Landing | pnpm lint, pnpm test, pnpm build; pnpm test:e2e for UI journeys |
| Annotate | pnpm typecheck, pnpm test, pnpm build |
| Launchpad | pnpm lint, pnpm test, pnpm build:hosting; pnpm --dir functions test |
| Docs | pnpm test in website; link/freshness scripts at repo root; pnpm --dir functions test |
Use the pinned lockfile and runtime for each repository. Auth, docs, and
launchpad functions target Node.js 22; the Flutter toolchain is pinned in
mise.toml.
What belongs at each layerโ
- Unit tests: pure validators, state mapping, quota/idempotency logic, formatting, and component behavior.
- Service tests: callable authorization, billing/refund behavior, session cookies, CSP nonce injection, HTTP routes, and Storage/Firestore adapters.
- Rules emulator tests: anonymous, owner, cross-owner, and admin access; server-owned field protection; MIME/size restrictions.
- Widget/component tests: navigation states, loading/error/empty states, claim refresh, and accessible controls.
- End-to-end tests: only high-value release journeys against an isolated environment, never destructive scenarios in production.
- Build checks: catch type errors, broken imports, prerender failures, Docusaurus links, and missing function-bundled site assets.
High-risk invariantsโ
Every change touching jobs, auth, billing, or private-site delivery should pin these behaviors:
- clients cannot create jobs or forge terminal state;
- a failure/retry releases quota and refunds cost no more than once;
- only a job owner or verified admin can read or mutate protected data;
- unverified allowlisted email does not grant admin access;
- App Check enforcement follows the deployed environment flag;
- docs/launchpad assets are not served without an authorized session;
- every served HTML script/style element receives the request nonce and inline event handlers are rejected by policy;
- unknown SPA/docs routes resolve deliberately, not by leaking a public bundle.
Test dataโ
Use emulator projects, deterministic fixtures, and synthetic videos. Mark sample jobs explicitly so they do not affect progression or billing. Never put real user video, production credentials, or live signed URLs in fixtures or snapshots.
Before deploymentโ
- Run the affected repository's complete gate, not just a focused test.
- Run rules tests when a data shape or client write changes.
- Build the deployable artifact from a clean dependency install.
- For docs, run
node scripts/check-links.mjsandnode scripts/check-freshness.mjsafter the website build. - Smoke-test auth, one read-only route, and health/log signals in the target project after deployment.
GPU backend tests are outside this audit. Control-plane adapters should be tested with fakes at their external boundary.