Frontend: cover config + domain logic, enforce a jest coverage gate - #14
Closed
mandarwagh9 wants to merge 1 commit into
Closed
mandarwagh9 wants to merge 1 commit into
mandarwagh9 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Changes
getIFFColor+estimateDistancefromCameraDisplay.jsxso the pure HUD helpers are testable without the canvas.config/index.test.js,CameraDisplay.helpers.test.js):getConfigpath resolution + defaults + dead-end fallback, the WS/API URL builders,validateConfig,getFullConfighomography_sourcefallback), distance-from-bbox-height (null guard, reference value, inverse relationship)package.json— jestcoverageThresholdon the logic layer (config + domain): statements/lines ≥ 55%, branches ≥ 45%, functions ≥ 30%;test:cinow runs--coverage..gitignorethe jestcoverage/output dir.Verification
npm run buildclean (eslint).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