Skip to content

Frontend: cover config + domain logic, enforce a jest coverage gate - #14

Closed
mandarwagh9 wants to merge 1 commit into
feat/phaseA-0-tooling-cifrom
chore/frontend-coverage
Closed

mandarwagh9 wants to merge 1 commit into
feat/phaseA-0-tooling-cifrom
chore/frontend-coverage

Conversation

@mandarwagh9

Copy link
Copy Markdown
Owner

What & why

The frontend had only 2 smoke tests and no enforced coverage — the biggest remaining "tested and checked" gap. This adds real logic tests plus a jest coverage threshold.

🌿 Parallel to the backend stack — based on #4 (the PR that introduced the frontend test infra), not stacked on the Phase-B chain, so it reviews independently. Auto-retargets to main when #4 merges.

Changes

  • Export getIFFColor + estimateDistance from CameraDisplay.jsx so the pure HUD helpers are testable without the canvas.
  • Tests (config/index.test.js, CameraDisplay.helpers.test.js):
    • config layer — getConfig path resolution + defaults + dead-end fallback, the WS/API URL builders, validateConfig, getFullConfig
    • HUD helpers — IFF colour by prediction method (HOMOGRAPHY→green, WORLD→orange, EXTRAP→red, homography_source fallback), distance-from-bbox-height (null guard, reference value, inverse relationship)
  • package.json — jest coverageThreshold on the logic layer (config + domain): statements/lines ≥ 55%, branches ≥ 45%, functions ≥ 30%; test:ci now runs --coverage.
  • .gitignore the jest coverage/ output dir.

Verification

  • 29 frontend tests pass (was 14); npm run build clean (eslint).
  • Logic-layer coverage 63% statements (gate at 55%).

Notes

Coverage is scoped to the pure-logic layer (config + domain). The canvas rendering in CameraDisplay (drawing functions, lines 46–490) and the hooks/adapters are a known gap better suited to component/e2e tests — a natural next ratchet.

🤖 Generated with Claude Code

The frontend had only 2 smoke tests and no enforced coverage. This adds real
logic tests + a jest coverage threshold, on a branch parallel to the backend
work (based on the A0 test-infra PR #4) so it reviews independently.

- export getIFFColor + estimateDistance from CameraDisplay so the pure HUD helpers
  are testable without the canvas.
- tests: config layer (getConfig path resolution/defaults, URL builders,
  validateConfig, getFullConfig) and CameraDisplay helpers (IFF colour by
  prediction method incl. homography_source fallback; distance-from-bbox-height).
- package.json: jest coverageThreshold on the logic layer (config + domain) —
  statements/lines >= 55%, branches >= 45%, functions >= 30%; test:ci runs --coverage.
- gitignore the jest coverage/ output dir.

29 frontend tests pass (was 14); logic-layer coverage 63%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mandarwagh9
mandarwagh9 deleted the branch feat/phaseA-0-tooling-ci June 19, 2026 15:44
@mandarwagh9
mandarwagh9 deleted the chore/frontend-coverage branch June 19, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant