Test: the streamed cap fails by assertion, not by timeout
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e23f7da2d5
commit
a85942e858
1 changed files with 2 additions and 2 deletions
|
|
@ -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`);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue