Skip to content

Commit

Permalink
test: replace forEach() in test-stream-pipe-unpipe-stream
Browse files Browse the repository at this point in the history
PR-URL: #50786
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
DevPres authored and marco-ippolito committed Jun 17, 2024
1 parent 161288e commit 7c1dd35
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/parallel/test-stream-pipe-unpipe-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ assert.strictEqual(source._readableState.pipes.length, 0);
const checkSrcCleanup = common.mustCall(() => {
assert.strictEqual(source._readableState.pipes.length, 0);
assert.strictEqual(source._readableState.flowing, false);

srcCheckEventNames.forEach((eventName) => {
for (const eventName of srcCheckEventNames) {
assert.strictEqual(
source.listenerCount(eventName), 0,
`source's '${eventName}' event listeners not removed`
);
});
}
});

function checkDestCleanup(dest) {
Expand All @@ -65,13 +64,13 @@ assert.strictEqual(source._readableState.pipes.length, 0);
'listener which is `unpipeChecker`'
);
dest.removeListener('unpipe', unpipeChecker);
destCheckEventNames.forEach((eventName) => {
for (const eventName of destCheckEventNames) {
assert.strictEqual(
dest.listenerCount(eventName), 0,
`destination{${currentDestId}}'s '${eventName}' event ` +
'listeners not removed'
);
});
}

if (--destCount === 0)
checkSrcCleanup();
Expand Down

0 comments on commit 7c1dd35

Please sign in to comment.