Skip to content

Commit

Permalink
test: remove common.expectsError calls for asserts
Browse files Browse the repository at this point in the history
PR-URL: #51504
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
opchaves authored and richardlau committed Mar 25, 2024
1 parent ca34458 commit d997522
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/fixtures/permission/fs-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder);
});
assert.throws(() => {
fs.writeFile(blockedFileURL, 'example', () => {});
}, common.expectsError({
}, {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: path.toNamespacedPath(blockedFile),
}));
});
assert.throws(() => {
fs.writeFile(relativeProtectedFile, 'example', () => {});
}, {
Expand Down Expand Up @@ -101,11 +101,11 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder);
});
assert.throws(() => {
fs.utimes(blockedFileURL, new Date(), new Date(), () => {});
}, common.expectsError({
}, {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: path.toNamespacedPath(blockedFile),
}));
});
assert.throws(() => {
fs.utimes(relativeProtectedFile, new Date(), new Date(), () => {});
}, {
Expand Down Expand Up @@ -134,11 +134,11 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder);
});
assert.throws(() => {
fs.lutimes(blockedFileURL, new Date(), new Date(), () => {});
}, common.expectsError({
}, {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: path.toNamespacedPath(blockedFile),
}));
});
}

// fs.mkdir
Expand Down Expand Up @@ -195,11 +195,11 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder);
fs.rename(blockedFileURL, path.join(blockedFile, 'renamed'), (err) => {
assert.ifError(err);
});
}, common.expectsError({
}, {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: path.toNamespacedPath(blockedFile),
}));
});
assert.throws(() => {
fs.rename(relativeProtectedFile, path.join(relativeProtectedFile, 'renamed'), (err) => {
assert.ifError(err);
Expand Down Expand Up @@ -467,4 +467,4 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder);
permission: 'FileSystemWrite',
resource: path.toNamespacedPath(blockedFile),
});
}
}

0 comments on commit d997522

Please sign in to comment.