Skip to content

Commit a98102a

Browse files
Ospite Privilegiatorichardlau
Ospite Privilegiato
authored andcommitted
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: #50787 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent e9080a9 commit a98102a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

test/parallel/test-fs-readv-sync.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,27 @@ const wrongInputs = [false, 'test', {}, [{}], ['sdf'], null, undefined];
6666
{
6767
const fd = fs.openSync(filename, 'r');
6868

69-
wrongInputs.forEach((wrongInput) => {
69+
for (const wrongInput of wrongInputs) {
7070
assert.throws(
7171
() => fs.readvSync(fd, wrongInput, null), {
7272
code: 'ERR_INVALID_ARG_TYPE',
7373
name: 'TypeError'
7474
}
7575
);
76-
});
76+
}
7777

7878
fs.closeSync(fd);
7979
}
8080

8181
{
8282
// fs.readv with wrong fd argument
83-
wrongInputs.forEach((wrongInput) => {
83+
for (const wrongInput of wrongInputs) {
8484
assert.throws(
8585
() => fs.readvSync(wrongInput),
8686
{
8787
code: 'ERR_INVALID_ARG_TYPE',
8888
name: 'TypeError'
8989
}
9090
);
91-
});
91+
}
9292
}

test/parallel/test-fs-readv.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,27 @@ const wrongInputs = [false, 'test', {}, [{}], ['sdf'], null, undefined];
6767
fs.writeFileSync(filename, exptectedBuff);
6868
const fd = fs.openSync(filename, 'r');
6969

70-
71-
wrongInputs.forEach((wrongInput) => {
70+
for (const wrongInput of wrongInputs) {
7271
assert.throws(
7372
() => fs.readv(fd, wrongInput, null, common.mustNotCall()), {
7473
code: 'ERR_INVALID_ARG_TYPE',
7574
name: 'TypeError'
7675
}
7776
);
78-
});
77+
}
7978

8079
fs.closeSync(fd);
8180
}
8281

8382
{
8483
// fs.readv with wrong fd argument
85-
wrongInputs.forEach((wrongInput) => {
84+
for (const wrongInput of wrongInputs) {
8685
assert.throws(
8786
() => fs.readv(wrongInput, common.mustNotCall()),
8887
{
8988
code: 'ERR_INVALID_ARG_TYPE',
9089
name: 'TypeError'
9190
}
9291
);
93-
});
92+
}
9493
}

0 commit comments

Comments
 (0)