Skip to content

Commit

Permalink
test: use common.mustNotMutateObjectDeep() in fs tests
Browse files Browse the repository at this point in the history
PR-URL: #43819
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
LiviaMedeiros authored and danielleadams committed Jul 26, 2022
1 parent 7762e46 commit 61cd11a
Show file tree
Hide file tree
Showing 19 changed files with 216 additions and 190 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-fs-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ assert.throws(

assert.throws(
() => {
fs.access(__filename, fs.F_OK, {});
fs.access(__filename, fs.F_OK, common.mustNotMutateObjectDeep({}));
},
{
code: 'ERR_INVALID_ARG_TYPE',
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-fs-append-file-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ const fileData3 = fs.readFileSync(filename3);
assert.strictEqual(buf.length + currentFileData.length, fileData3.length);

const filename4 = join(tmpdir.path, 'append-sync4.txt');
fs.writeFileSync(filename4, currentFileData, { mode: m });
fs.writeFileSync(filename4, currentFileData, common.mustNotMutateObjectDeep({ mode: m }));

[
true, false, 0, 1, Infinity, () => {}, {}, [], undefined, null,
].forEach((value) => {
assert.throws(
() => fs.appendFileSync(filename4, value, { mode: m }),
() => fs.appendFileSync(filename4, value, common.mustNotMutateObjectDeep({ mode: m })),
{ message: /data/, code: 'ERR_INVALID_ARG_TYPE' }
);
});
fs.appendFileSync(filename4, `${num}`, { mode: m });
fs.appendFileSync(filename4, `${num}`, common.mustNotMutateObjectDeep({ mode: m }));

// Windows permissions aren't Unix.
if (!common.isWindows) {
Expand Down
Loading

0 comments on commit 61cd11a

Please sign in to comment.