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 2023-05-18 23:37:57 +10:00
parent 996d198101
commit eb46e09570
No known key found for this signature in database
GPG Key ID: 4EE6CDFABEDBF6D1
3 changed files with 33 additions and 0 deletions

View File

@ -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();
}

View File

@ -248,3 +248,9 @@ const {
reader.closed.then(common.mustCall());
writer.close().then(common.mustCall());
}
{
assert.throws(() => newReadableWritablePairFromDuplex(null), {
code: 'ERR_INVALID_ARG_TYPE'
});
}

View File

@ -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',
});
}