test: fix error code typo
PR-URL: https://github.com/nodejs/node/pull/27024 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
0916749c07
commit
e573394937
@ -23,8 +23,9 @@ function beforeEach() {
|
||||
fs.chmodSync(dest, '444');
|
||||
|
||||
const check = (err) => {
|
||||
assert.strictEqual(err.code, 'EACCESS');
|
||||
assert.strictEqual(err.code, 'EACCES');
|
||||
assert.strictEqual(fs.readFileSync(dest, 'utf8'), 'dest');
|
||||
return true;
|
||||
};
|
||||
|
||||
return { source, dest, check };
|
||||
@ -39,8 +40,9 @@ function beforeEach() {
|
||||
// Test promises API.
|
||||
{
|
||||
const { source, dest, check } = beforeEach();
|
||||
assert.throws(async () => { await fs.promises.copyFile(source, dest); },
|
||||
check);
|
||||
(async () => {
|
||||
await assert.rejects(fs.promises.copyFile(source, dest), check);
|
||||
})();
|
||||
}
|
||||
|
||||
// Test callback API.
|
||||
|
Loading…
x
Reference in New Issue
Block a user