From 800b6f65cfbd343dffb9e87f1a69d00e64a173f2 Mon Sep 17 00:00:00 2001 From: Dario <61739181+DevPres@users.noreply.github.com> Date: Sun, 12 May 2024 12:28:20 +0200 Subject: [PATCH] test: replace `forEach()` in `test-stream-pipe-unpipe-stream` PR-URL: https://github.com/nodejs/node/pull/50786 Reviewed-By: James M Snell Reviewed-By: Rafael Gonzaga Reviewed-By: Luigi Pinca --- test/parallel/test-stream-pipe-unpipe-streams.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js index b1a673d9450ce8..74c435399335d2 100644 --- a/test/parallel/test-stream-pipe-unpipe-streams.js +++ b/test/parallel/test-stream-pipe-unpipe-streams.js @@ -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();