From dd8a10948195f231a6a9eb652e3f208813904ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 21 Feb 2020 10:36:13 -0500 Subject: refactor: remove unneeded ErrorKinds (#3936) --- cli/js/read_dir_test.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'cli/js/read_dir_test.ts') diff --git a/cli/js/read_dir_test.ts b/cli/js/read_dir_test.ts index 77d2cbfe2..4496d7447 100644 --- a/cli/js/read_dir_test.ts +++ b/cli/js/read_dir_test.ts @@ -32,8 +32,7 @@ testPerm({ read: false }, function readDirSyncPerm(): void { Deno.readDirSync("tests/"); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } assert(caughtError); }); @@ -46,7 +45,7 @@ testPerm({ read: true }, function readDirSyncNotDir(): void { src = Deno.readDirSync("cli/tests/fixture.json"); } catch (err) { caughtError = true; - assertEquals(err.kind, Deno.ErrorKind.Other); + assert(err instanceof Error); } assert(caughtError); assertEquals(src, undefined); @@ -60,7 +59,7 @@ testPerm({ read: true }, function readDirSyncNotFound(): void { src = Deno.readDirSync("bad_dir_name"); } catch (err) { caughtError = true; - assertEquals(err.kind, Deno.ErrorKind.NotFound); + assert(err instanceof Deno.Err.NotFound); } assert(caughtError); assertEquals(src, undefined); @@ -77,8 +76,7 @@ testPerm({ read: false }, async function readDirPerm(): Promise { await Deno.readDir("tests/"); } catch (e) { caughtError = true; - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } assert(caughtError); }); -- cgit v1.2.3