diff --git a/test/parallel/test-whatwg-webstreams-adapters-streambase.js b/test/parallel/test-whatwg-webstreams-adapters-streambase.js index 43d28f0499dc7d..bd864ab8c14195 100644 --- a/test/parallel/test-whatwg-webstreams-adapters-streambase.js +++ b/test/parallel/test-whatwg-webstreams-adapters-streambase.js @@ -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(); +} diff --git a/test/parallel/test-whatwg-webstreams-adapters-to-readablewritablepair.js b/test/parallel/test-whatwg-webstreams-adapters-to-readablewritablepair.js index 83d21247a49265..5062b9e179ac1e 100644 --- a/test/parallel/test-whatwg-webstreams-adapters-to-readablewritablepair.js +++ b/test/parallel/test-whatwg-webstreams-adapters-to-readablewritablepair.js @@ -248,3 +248,9 @@ const { reader.closed.then(common.mustCall()); writer.close().then(common.mustCall()); } + +{ + assert.throws(() => newReadableWritablePairFromDuplex(null), { + code: 'ERR_INVALID_ARG_TYPE' + }); +} diff --git a/test/parallel/test-whatwg-webstreams-adapters-to-streamduplex.js b/test/parallel/test-whatwg-webstreams-adapters-to-streamduplex.js index 15ac9f832714e9..9c92a4778a00fd 100644 --- a/test/parallel/test-whatwg-webstreams-adapters-to-streamduplex.js +++ b/test/parallel/test-whatwg-webstreams-adapters-to-streamduplex.js @@ -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', + }); +}