test: test streambase has already has a consumer

test: test streambase has already has a consumer
PR-URL: https://github.com/nodejs/node/pull/48059
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Jithil P Ponnan authored and Michaël Zasso committed 2023-11-23 10:15:44 +01:00
1 parent 0d3aa725cf
commit 377deded59
3 files changed
+33

No files matched your search

@@ -65,3 +65,12 @@ const {
const readable = newReadableStreamFromStreamBase(stream);
readable.cancel().then(common.mustCall());
}
{
const stream = new JSStream();
stream.onread = common.mustCall();
assert.throws(() => newReadableStreamFromStreamBase(stream), {
code: 'ERR_INVALID_STATE'
});
stream.emitEOF();
}
@@ -248,3 +248,9 @@ const {
reader.closed.then(common.mustCall());
writer.close().then(common.mustCall());
}
{
assert.throws(() => newReadableWritablePairFromDuplex(null), {
code: 'ERR_INVALID_ARG_TYPE'
});
}
@@ -164,3 +164,21 @@ const {
duplex.end();
}
{
const transform = { readable: {}, writable: {} };
assert.throws(() => newStreamDuplexFromReadableWritablePair(transform), {
code: 'ERR_INVALID_ARG_TYPE'
});
}
{
const transform = {
readable: new ReadableStream(),
writable: null
};
assert.throws(() => newStreamDuplexFromReadableWritablePair(transform), {
code: 'ERR_INVALID_ARG_TYPE',
});
}