test: replace forEach with for...of

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 <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Ospite Privilegiato 2023-11-18 16:40:37 +01:00 committed by Luigi Pinca
parent a950d40ad6
commit ecaf9c3118
2 changed files with 8 additions and 9 deletions

View File

@ -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'
}
);
});
}
}

View File

@ -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'
}
);
});
}
}