test(frontend): SSE/client unit tests + coverage ratchet

↗ view on GitHub · Amalanand Muthukumaran · 2026-07-25 · 2392e677

Unit tests for the frontend client library and the SSE stream consumer,
plus a v8 coverage ratchet over src/app/lib/** mirroring the backend's
(floors just below measured, only ever raised):

- mikeApi.ts: request/auth/error plumbing, blob downloads, getChat and
  mapTRMessages mapping, and all four streaming endpoints (the frontend
  half of the SSE contract - raw Response passed through unconsumed).
- useAssistantChat: SSE parse loop against real ReadableStream bodies -
  chunk-boundary reassembly, multi-event chunks, reasoning/content
  interleave, error events, malformed lines, EOF without trailing newline.
- documentUploadValidation.ts and modelAvailability.ts: full coverage.
- test:coverage script + @vitest/coverage-v8; CI frontend test step now
  runs it (still --if-present).
- docs/frontend-testing.md: how to run, ratchet rules, TODO backlog.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository open-legal-products/mike
Author Amalanand Muthukumaran <mamalanand3@gmail.com>
Authored
Parents c0ff4404
Stats 9 files changed , +1336 , -18
Part of Add frontend test coverage ratchet

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-2392e677.md from inside the repo you want the change in.

⬇ Download capture-commit-2392e677.md