Skip to content

Commit

Permalink
test: wrap missing common.mustCall
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Oct 19, 2022
1 parent 87cdf7d commit affe112
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/parallel/test-stream-promises.js
Expand Up @@ -119,27 +119,25 @@ assert.strictEqual(finished, promisify(stream.finished));
{
const streamObj = new Writable();
assert.strictEqual(streamObj.listenerCount('end'), 0);
finished(streamObj, { cleanup: false }).then(() => {
assert.strictEqual(streamObj.listenerCount('end'), 1);
});
finished(streamObj, { cleanup: false }).then(common.mustNotCall());
}

// Cleanup function should be called when cleanup is set to true
// listenerCount should be 0 after calling finish
{
const streamObj = new Writable();
assert.strictEqual(streamObj.listenerCount('end'), 0);
finished(streamObj, { cleanup: true }).then(() => {
finished(streamObj, { cleanup: true }).then(common.mustCall(() => {
assert.strictEqual(streamObj.listenerCount('end'), 0);
});
}));
}

// Cleanup function should not be called when cleanup has not been set
// listenerCount should be 1 after calling finish
{
const streamObj = new Writable();
assert.strictEqual(streamObj.listenerCount('end'), 0);
finished(streamObj).then(() => {
finished(streamObj).then(common.mustCall(() => {
assert.strictEqual(streamObj.listenerCount('end'), 1);
});
}));
}

0 comments on commit affe112

Please sign in to comment.