mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Replace `Array.prototype.forEach()` with `for...of` loops across 17 tests in `test/parallel`, so each loop body reads as a plain statement rather than an arrow callback. None of the iterated values are sparse arrays, the one case where `forEach` and `for...of` genuinely differ, so both constructs visit the same elements in the same order. No callback relied on `this`, an early return, or async behaviour, and the number of assertions run in each file is unchanged. Signed-off-by: Phillip Markert <phillip@ephisys.com> PR-URL: https://github.com/nodejs/node/pull/65272 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
18 lines
404 B
JavaScript
18 lines
404 B
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
// This test ensures that writeSync throws for invalid data input.
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
const testCases = [
|
|
true, false, 0, 1, Infinity, () => {}, {}, [], undefined, null,
|
|
];
|
|
for (const value of testCases) {
|
|
assert.throws(
|
|
() => fs.writeSync(1, value),
|
|
{ message: /"buffer"/, code: 'ERR_INVALID_ARG_TYPE' }
|
|
);
|
|
}
|