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: nodejs#50786
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
DevPres authored May 12, 2024
1 parent 56b3162 commit 06cde5c
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 06cde5c

Please sign in to comment.