Skip to content

Frontend: test the HTTP API adapter, ratchet coverage gate - #15

Merged
mandarwagh9 merged 2 commits into
mainfrom
chore/frontend-adapter-tests
Jun 19, 2026
Merged

mandarwagh9 merged 2 commits into
mainfrom
chore/frontend-adapter-tests

Conversation

@mandarwagh9

Copy link
Copy Markdown
Owner

What & why

Extends the frontend test coverage to the HTTP API adapter and ratchets the coverage gate up.

🌿 Stacked on the frontend-coverage PR (#14), which is itself parallel to the backend stack (off #4). Independent of the backend feature chain.

Changes

  • Tests (apiAdapter.test.js):
    • ApiResponseisSuccess, getOrThrow (returns data / throws with message or HTTP <status>)
    • buildUrl — leading-slash normalization
    • fetch-mocked get/post — success → parsed data, HTTP error → failed ApiResponse with status, network error → status 0, startCamera/stopCamera hit the right POST paths, JSON body serialization
  • package.json — added apiAdapter.js to the coverage scope and raised the global gate: statements/lines ≥ 65%, branches ≥ 55%, functions ≥ 40%.

Verification

  • 40 frontend tests pass (was 29); apiAdapter.js coverage 86%; npm run build clean.

🤖 Generated with Claude Code

mandarwagh9 and others added 2 commits June 19, 2026 20:14
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>
Stacks on the frontend-coverage PR. Adds tests for apiAdapter and raises the jest
coverage threshold.

- tests: ApiResponse (isSuccess, getOrThrow success/throw), buildUrl (leading-slash
  normalization), and fetch-mocked get/post (success, HTTP error -> failed response,
  network error -> status 0, startCamera/stopCamera paths, JSON body serialization).
- package.json: add apiAdapter.js to coverage scope; raise the global gate to
  statements/lines >= 65%, branches >= 55%, functions >= 40%.

40 frontend tests pass (was 29); apiAdapter coverage 86%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mandarwagh9
mandarwagh9 changed the base branch from chore/frontend-coverage to main June 19, 2026 15:48
@mandarwagh9
mandarwagh9 merged commit b761a0d into main Jun 19, 2026
2 checks passed
@mandarwagh9
mandarwagh9 deleted the chore/frontend-adapter-tests 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