mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: replace forEach()
in test-stream-pipe-unpipe-stream
PR-URL: https://github.com/nodejs/node/pull/50786 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
56b316294d
commit
06cde5c902
@ -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) {
|
||||
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user