Skip to content

Commit cacf709

Browse files
committed
test: cover BYOB Readable.toWeb termination
1 parent 6434eb7 commit cacf709

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test/parallel/test-whatwg-webstreams-adapters-to-readablestream.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,27 @@ const {
307307
})().then(common.mustCall());
308308
}
309309

310+
{
311+
const readable = new PassThrough();
312+
const readableStream = newReadableStreamFromStreamReadable(readable, {
313+
type: 'bytes',
314+
});
315+
const reader = readableStream.getReader({ mode: 'byob' });
316+
317+
(async () => {
318+
const readPromise = reader.read(new Uint8Array(8));
319+
320+
readable.end();
321+
await once(readable, 'end');
322+
323+
assert.deepStrictEqual(await readPromise, {
324+
value: new Uint8Array(0),
325+
done: true,
326+
});
327+
await reader.closed;
328+
})().then(common.mustCall());
329+
}
330+
310331
{
311332
const duplex = new Duplex({ readable: false });
312333
duplex.destroy();

0 commit comments

Comments
 (0)