mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
refactor(cli/tests/unit) to use assertThrows (#6459)
This commit is contained in:
parent
6bbe52fba3
commit
87f8f99c49
28 changed files with 404 additions and 913 deletions
|
@ -43,32 +43,22 @@ unitTest(
|
|||
unitTest(
|
||||
{ perms: { read: false, write: true } },
|
||||
function renameSyncReadPerm(): void {
|
||||
let err;
|
||||
try {
|
||||
assertThrows(() => {
|
||||
const oldpath = "/oldbaddir";
|
||||
const newpath = "/newbaddir";
|
||||
Deno.renameSync(oldpath, newpath);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
assert(err instanceof Deno.errors.PermissionDenied);
|
||||
assertEquals(err.name, "PermissionDenied");
|
||||
}, Deno.errors.PermissionDenied);
|
||||
}
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: false } },
|
||||
function renameSyncWritePerm(): void {
|
||||
let err;
|
||||
try {
|
||||
assertThrows(() => {
|
||||
const oldpath = "/oldbaddir";
|
||||
const newpath = "/newbaddir";
|
||||
Deno.renameSync(oldpath, newpath);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
assert(err instanceof Deno.errors.PermissionDenied);
|
||||
assertEquals(err.name, "PermissionDenied");
|
||||
}, Deno.errors.PermissionDenied);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue