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 8073d3f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/parallel/test-stream-promises.js
Expand Up @@ -119,27 +119,30 @@ assert.strictEqual(finished, promisify(stream.finished));
{
const streamObj = new Writable();
assert.strictEqual(streamObj.listenerCount('end'), 0);
finished(streamObj, { cleanup: false }).then(() => {
finished(streamObj, { cleanup: false }).then(common.mustCall(() => {
assert.strictEqual(streamObj.listenerCount('end'), 1);
});
}));
streamObj.end();
}

// 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);
});
}));
streamObj.end();
}

// 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);
});
}));
streamObj.end();
}

0 comments on commit 8073d3f

Please sign in to comment.