Skip to content

Commit

Permalink
test: test streambase already has a consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJithil committed Oct 11, 2023
1 parent ed49722 commit f451c28
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(() => {});

Check failure on line 71 in test/parallel/test-whatwg-webstreams-adapters-streambase.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Do not use an empty function, omit the parameter altogether
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 f451c28

Please sign in to comment.