From db88bf185f19f29c9d52ceb6e2dd52d930dc2c56 Mon Sep 17 00:00:00 2001 From: Paulo Chaves Date: Thu, 25 Jan 2024 13:47:22 -0800 Subject: [PATCH] test: remove common.expectsError calls for asserts PR-URL: https://github.com/nodejs/node/pull/51504 Reviewed-By: Rafael Gonzaga Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca --- test/fixtures/permission/fs-write.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/fixtures/permission/fs-write.js b/test/fixtures/permission/fs-write.js index 8c0bf3124b0af3..5e7e1ac588ee76 100644 --- a/test/fixtures/permission/fs-write.js +++ b/test/fixtures/permission/fs-write.js @@ -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', () => {}); }, { @@ -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(), () => {}); }, { @@ -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 @@ -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); @@ -467,4 +467,4 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder); permission: 'FileSystemWrite', resource: path.toNamespacedPath(blockedFile), }); -} +} \ No newline at end of file