Skip to content

Commit

Permalink
test: use common.mustNotMutate() in fs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed May 31, 2022
1 parent 7c41890 commit 48a8bd1
Show file tree
Hide file tree
Showing 19 changed files with 224 additions and 204 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.mustNotMutate({}));
},
{
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.mustNotMutate({ mode: m }));

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

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

0 comments on commit 48a8bd1

Please sign in to comment.