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
  • Loading branch information
MrJithil committed Nov 3, 2023
1 parent 8373643 commit 6ade593
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 6ade593

Please sign in to comment.