diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-02-21 10:36:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 10:36:13 -0500 |
commit | dd8a10948195f231a6a9eb652e3f208813904ad6 (patch) | |
tree | f9a4afeb67bbead882c29c2458a5f1f99e2e42db /cli/js/write_file_test.ts | |
parent | d9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff) |
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'cli/js/write_file_test.ts')
-rw-r--r-- | cli/js/write_file_test.ts | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/cli/js/write_file_test.ts b/cli/js/write_file_test.ts index 2b952655f..9f58f4460 100644 --- a/cli/js/write_file_test.ts +++ b/cli/js/write_file_test.ts @@ -22,8 +22,7 @@ testPerm({ write: true }, function writeFileSyncFail(): void { Deno.writeFileSync(filename, data); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.NotFound); - assertEquals(e.name, "NotFound"); + assert(e instanceof Deno.Err.NotFound); } assert(caughtError); }); @@ -38,8 +37,7 @@ testPerm({ write: false }, function writeFileSyncPerm(): void { Deno.writeFileSync(filename, data); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } assert(caughtError); }); @@ -66,8 +64,7 @@ testPerm({ read: true, write: true }, function writeFileSyncCreate(): void { Deno.writeFileSync(filename, data, { create: false }); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.NotFound); - assertEquals(e.name, "NotFound"); + assert(e instanceof Deno.Err.NotFound); } assert(caughtError); @@ -128,8 +125,7 @@ testPerm( await Deno.writeFile(filename, data); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.NotFound); - assertEquals(e.name, "NotFound"); + assert(e instanceof Deno.Err.NotFound); } assert(caughtError); } @@ -147,8 +143,7 @@ testPerm({ read: true, write: false }, async function writeFilePerm(): Promise< await Deno.writeFile(filename, data); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } assert(caughtError); }); @@ -180,8 +175,7 @@ testPerm({ read: true, write: true }, async function writeFileCreate(): Promise< await Deno.writeFile(filename, data, { create: false }); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.NotFound); - assertEquals(e.name, "NotFound"); + assert(e instanceof Deno.Err.NotFound); } assert(caughtError); |