mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
test(01-10): add red assessment and records contracts
- pin honest assessment fallback, exhaustion, foreground, and state envelopes - require consistent save and empty-state add action grammar
This commit is contained in:
1 parent
d8e52b831d
commit
18d0facdfe
7 files changed
+362
-7
No files matched your search
@@ -1,4 +1,6 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
import {
|
||||
nextStatusPollInterval,
|
||||
@@ -65,4 +67,18 @@ describe("nextStatusPollInterval — v1.8.4 poll ceiling", () => {
|
||||
nextStatusPollInterval(false, STATUS_POLL_MAX_ATTEMPTS + 5, true),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("exposes poll exhaustion as a terminal state instead of leaving preparing true forever", () => {
|
||||
const source = readFileSync(
|
||||
join(process.cwd(), "src", "hooks", "use-insight-status.ts"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
// Stopping the timer is only half of the contract. Once the ceiling is
|
||||
// reached, callers must be able to distinguish an exhausted attempt from
|
||||
// an actively preparing response and must not keep painting the preparing
|
||||
// skeleton forever.
|
||||
expect(source).toContain("pollExhausted");
|
||||
expect(source).toMatch(/preparing:\s*false/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user