Skip to content

Commit

Permalink
test: wrap missing common.mustCall
Browse files Browse the repository at this point in the history
PR-URL: #45064
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
MoLow authored and RafaelGSS committed Nov 10, 2022
1 parent b4bedde commit 26a2ae2
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 26a2ae2

Please sign in to comment.