summaryrefslogtreecommitdiff
path: root/cli/js/copy_file_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-21 10:36:13 -0500
committerGitHub <noreply@github.com>2020-02-21 10:36:13 -0500
commitdd8a10948195f231a6a9eb652e3f208813904ad6 (patch)
treef9a4afeb67bbead882c29c2458a5f1f99e2e42db /cli/js/copy_file_test.ts
parentd9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff)
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'cli/js/copy_file_test.ts')
-rw-r--r--cli/js/copy_file_test.ts18
1 files changed, 6 insertions, 12 deletions
diff --git a/cli/js/copy_file_test.ts b/cli/js/copy_file_test.ts
index 88dc3fdbf..567b246b7 100644
--- a/cli/js/copy_file_test.ts
+++ b/cli/js/copy_file_test.ts
@@ -43,8 +43,7 @@ testPerm({ write: true, read: true }, function copyFileSyncFailure(): void {
err = e;
}
assert(!!err);
- assertEquals(err.kind, Deno.ErrorKind.NotFound);
- assertEquals(err.name, "NotFound");
+ assert(err instanceof Deno.Err.NotFound);
});
testPerm({ write: true, read: false }, function copyFileSyncPerm1(): void {
@@ -53,8 +52,7 @@ testPerm({ write: true, read: false }, function copyFileSyncPerm1(): void {
Deno.copyFileSync("/from.txt", "/to.txt");
} catch (e) {
caughtError = true;
- assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
- assertEquals(e.name, "PermissionDenied");
+ assert(e instanceof Deno.Err.PermissionDenied);
}
assert(caughtError);
});
@@ -65,8 +63,7 @@ testPerm({ write: false, read: true }, function copyFileSyncPerm2(): void {
Deno.copyFileSync("/from.txt", "/to.txt");
} catch (e) {
caughtError = true;
- assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
- assertEquals(e.name, "PermissionDenied");
+ assert(e instanceof Deno.Err.PermissionDenied);
}
assert(caughtError);
});
@@ -113,8 +110,7 @@ testPerm({ read: true, write: true }, async function copyFileFailure(): Promise<
err = e;
}
assert(!!err);
- assertEquals(err.kind, Deno.ErrorKind.NotFound);
- assertEquals(err.name, "NotFound");
+ assert(err instanceof Deno.Err.NotFound);
});
testPerm(
@@ -142,8 +138,7 @@ testPerm({ read: false, write: true }, async function copyFilePerm1(): Promise<
await Deno.copyFile("/from.txt", "/to.txt");
} catch (e) {
caughtError = true;
- assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
- assertEquals(e.name, "PermissionDenied");
+ assert(e instanceof Deno.Err.PermissionDenied);
}
assert(caughtError);
});
@@ -156,8 +151,7 @@ testPerm({ read: true, write: false }, async function copyFilePerm2(): Promise<
await Deno.copyFile("/from.txt", "/to.txt");
} catch (e) {
caughtError = true;
- assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
- assertEquals(e.name, "PermissionDenied");
+ assert(e instanceof Deno.Err.PermissionDenied);
}
assert(caughtError);
});