From 0e511b180ff9291a7ce9f60b3df2a83da059d955 Mon Sep 17 00:00:00 2001 From: Ospite Privilegiato Date: Sat, 18 Nov 2023 16:40:37 +0100 Subject: [PATCH] test: replace forEach with for...of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace `Array.prototype.forEach()` with `for...of` in `test/parallel/test-fs-readv-sync.js` and `test/parallel/test-fs-readv.js`. PR-URL: https://github.com/nodejs/node/pull/50787 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Ulises Gascón Reviewed-By: Marco Ippolito --- test/parallel/test-fs-readv-sync.js | 8 ++++---- test/parallel/test-fs-readv.js | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-fs-readv-sync.js b/test/parallel/test-fs-readv-sync.js index 22f28c7830e746..548f54cbb9e3b2 100644 --- a/test/parallel/test-fs-readv-sync.js +++ b/test/parallel/test-fs-readv-sync.js @@ -66,21 +66,21 @@ const wrongInputs = [false, 'test', {}, [{}], ['sdf'], null, undefined]; { const fd = fs.openSync(filename, 'r'); - wrongInputs.forEach((wrongInput) => { + for (const wrongInput of wrongInputs) { assert.throws( () => fs.readvSync(fd, wrongInput, null), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' } ); - }); + } fs.closeSync(fd); } { // fs.readv with wrong fd argument - wrongInputs.forEach((wrongInput) => { + for (const wrongInput of wrongInputs) { assert.throws( () => fs.readvSync(wrongInput), { @@ -88,5 +88,5 @@ const wrongInputs = [false, 'test', {}, [{}], ['sdf'], null, undefined]; name: 'TypeError' } ); - }); + } } diff --git a/test/parallel/test-fs-readv.js b/test/parallel/test-fs-readv.js index aa24c3e06ba4de..111719a7efbb0f 100644 --- a/test/parallel/test-fs-readv.js +++ b/test/parallel/test-fs-readv.js @@ -67,22 +67,21 @@ const wrongInputs = [false, 'test', {}, [{}], ['sdf'], null, undefined]; fs.writeFileSync(filename, exptectedBuff); const fd = fs.openSync(filename, 'r'); - - wrongInputs.forEach((wrongInput) => { + for (const wrongInput of wrongInputs) { assert.throws( () => fs.readv(fd, wrongInput, null, common.mustNotCall()), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' } ); - }); + } fs.closeSync(fd); } { // fs.readv with wrong fd argument - wrongInputs.forEach((wrongInput) => { + for (const wrongInput of wrongInputs) { assert.throws( () => fs.readv(wrongInput, common.mustNotCall()), { @@ -90,5 +89,5 @@ const wrongInputs = [false, 'test', {}, [{}], ['sdf'], null, undefined]; name: 'TypeError' } ); - }); + } }