Skip to main content

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โ€‹

RepositoryCommands
Flutter appdart format --output=none --set-exit-if-changed lib test, flutter analyze, flutter test
Auth/functionspnpm lint, pnpm build, pnpm test
Firestore/Storage rulesnpm run test:rules:emulator in acesense-frontend
Adminpnpm lint, pnpm test, pnpm build; pnpm test:e2e for UI journeys
Landingpnpm lint, pnpm test, pnpm build; pnpm test:e2e for UI journeys
Annotatepnpm typecheck, pnpm test, pnpm build
Launchpadpnpm lint, pnpm test, pnpm build:hosting; pnpm --dir functions test
Docspnpm 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โ€‹

  1. Run the affected repository's complete gate, not just a focused test.
  2. Run rules tests when a data shape or client write changes.
  3. Build the deployable artifact from a clean dependency install.
  4. For docs, run node scripts/check-links.mjs and node scripts/check-freshness.mjs after the website build.
  5. 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.