mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
The /insights mother page no longer fetches the `/api/insights/general-status` endpoint — InsightAdvisorCard reads `/api/insights/generate` (a POST that doubles as cache-aware read), gated by `/api/insights/comprehensive` returning a non-null payload. The old test mocked a dead endpoint, hit the EmptyState CTA path, and asserted on a literal AI prose substring that the renderer never produces verbatim — twice brittle. Swap the mocks to the real endpoints with a minimal-but-valid `InsightResult` payload, then assert on the populated card's stable structural hook `[data-slot="insight-summary"]`. The hook is set by `InsightAdvisorCard` on the populated-body branch only, so the assertion still proves "the card mounts its summary when the payload arrives" — the actual contract under test — without coupling to AI prose that varies per provider and cache state by design.