mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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:
parent
a950d40ad6
commit
ecaf9c3118
@ -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'
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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'
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user