feat(sp28): claimAcks slice + useTailStream/useMergedTail dispatch
This commit is contained in:
@@ -127,6 +127,30 @@ describe("streamTail", () => {
|
||||
expect(calledUrl).toBe("/api/ta1-acks/stream");
|
||||
});
|
||||
|
||||
it("test_targets_claim_acks_stream_endpoint", async () => {
|
||||
// SP28: the `claim-acks` resource is part of TailResource; the URL
|
||||
// must be /api/claim-acks/stream. The claim↔ack link stream is a
|
||||
// shared resource (not per-claim or per-ack) — both the ClaimDrawer
|
||||
// and AckDrawer subscribe to the same endpoint and filter
|
||||
// server-side via the page-specific filterFn passed to
|
||||
// `useMergedTail`.
|
||||
const driver = makeStream();
|
||||
const fetchMock = vi.fn().mockResolvedValue(driver.response);
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
// Drive an event so the iterator's first read resolves — same
|
||||
// pattern as `test_parses_well_formed_ndjson_into_typed_events`
|
||||
// (the `test_targets_acks_stream_endpoint` shape hangs in CI
|
||||
// because it awaits `gen.next()` before any chunk arrives).
|
||||
const gen = streamTail("claim-acks");
|
||||
driver.push('{"type":"snapshot_end","data":{"count":0}}');
|
||||
driver.close();
|
||||
await gen.next();
|
||||
await gen.return?.(undefined);
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||
const [calledUrl] = fetchMock.mock.calls[0] as [string];
|
||||
expect(calledUrl).toBe("/api/claim-acks/stream");
|
||||
});
|
||||
|
||||
it("test_handles_heartbeat_silently", async () => {
|
||||
// "Silently" here means: still yields the correctly-typed heartbeat
|
||||
// (no special filtering) — the consumer (useTailStream) decides what
|
||||
|
||||
Reference in New Issue
Block a user