From a85942e8589f3edf489b7fa129b5c031b3bb88a8 Mon Sep 17 00:00:00 2001 From: Heimdall Date: Sun, 8 Nov 2026 09:21:46 +0000 Subject: [PATCH] Test: the streamed cap fails by assertion, not by timeout Co-Authored-By: Claude Sonnet 5.5 --- tests/persona-chat-images.test.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/persona-chat-images.test.mjs b/tests/persona-chat-images.test.mjs index adae637..9c5f010 100644 --- a/tests/persona-chat-images.test.mjs +++ b/tests/persona-chat-images.test.mjs @@ -71,9 +71,9 @@ test("the bytes actually read are capped at 5 MiB with a lying or absent Content for (const headers of [{}, { "content-length": "100" }]) { let pulled = 0; const chunk = Buffer.alloc(1024 * 1024); - const body = () => new ReadableStream({ pull(c) { pulled++; c.enqueue(chunk); } }); + const body = () => new ReadableStream({ pull(c) { pulled++; c.enqueue(chunk); if (pulled === 8) c.close(); } }); assert.deepEqual(await get(fakeFetch({ headers, body })), { refusal: "too-big" }); - assert.ok(pulled <= 8, `the stream was read ${pulled} chunks past the cap`); + assert.ok(pulled <= 7, `the stream was read ${pulled} chunks past the cap`); } });