Skip to content

Commit

Permalink
test: test streambase has already has a consumer
Browse files Browse the repository at this point in the history
test: test streambase has already has a consumer
PR-URL: #48059
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
MrJithil authored and UlisesGascon committed Dec 19, 2023
1 parent 6f46d31 commit 49e5f47
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/parallel/test-whatwg-webstreams-adapters-streambase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,9 @@ const {
reader.closed.then(common.mustCall());
writer.close().then(common.mustCall());
}

{
assert.throws(() => newReadableWritablePairFromDuplex(null), {
code: 'ERR_INVALID_ARG_TYPE'
});
}
18 changes: 18 additions & 0 deletions test/parallel/test-whatwg-webstreams-adapters-to-streamduplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
}

0 comments on commit 49e5f47

Please sign in to comment.