diff options
Diffstat (limited to 'cli/js/chown_test.ts')
-rw-r--r-- | cli/js/chown_test.ts | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/cli/js/chown_test.ts b/cli/js/chown_test.ts index 61132ae31..a1c12860d 100644 --- a/cli/js/chown_test.ts +++ b/cli/js/chown_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { testPerm, assertEquals } from "./test_util.ts"; +import { testPerm, assertEquals, assert } from "./test_util.ts"; // chown on Windows is noop for now, so ignore its testing on Windows if (Deno.build.os !== "win") { @@ -31,8 +31,7 @@ if (Deno.build.os !== "win") { try { await Deno.chown(filePath, 1000, 1000); } catch (e) { - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } }); @@ -45,8 +44,7 @@ if (Deno.build.os !== "win") { try { Deno.chownSync(filePath, uid, gid); } catch (e) { - assertEquals(e.kind, Deno.ErrorKind.NotFound); - assertEquals(e.name, "NotFound"); + assert(e instanceof Deno.Err.NotFound); } } ); @@ -60,8 +58,7 @@ if (Deno.build.os !== "win") { try { await Deno.chown(filePath, uid, gid); } catch (e) { - assertEquals(e.kind, Deno.ErrorKind.NotFound); - assertEquals(e.name, "NotFound"); + assert(e instanceof Deno.Err.NotFound); } } ); @@ -77,8 +74,7 @@ if (Deno.build.os !== "win") { // try changing the file's owner to root Deno.chownSync(filePath, 0, 0); } catch (e) { - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } Deno.removeSync(dirPath, { recursive: true }); }); @@ -96,8 +92,7 @@ if (Deno.build.os !== "win") { // try changing the file's owner to root await Deno.chown(filePath, 0, 0); } catch (e) { - assertEquals(e.kind, Deno.ErrorKind.PermissionDenied); - assertEquals(e.name, "PermissionDenied"); + assert(e instanceof Deno.Err.PermissionDenied); } await Deno.remove(dirPath, { recursive: true }); }); |