summaryrefslogtreecommitdiff
path: root/std/permissions/test.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-19 21:32:49 +1100
committerGitHub <noreply@github.com>2020-03-19 11:32:49 +0100
commit5b10ab0984fd762c14caf524d59ec8b6940d2bfb (patch)
tree1201c46987eacaf93b99231eb28ed1d1dd7998ea /std/permissions/test.ts
parentb0b27c43100bf4a7303174b9765c853d2f76f207 (diff)
feat: Add helper functions for permissions to std (#4258)
Diffstat (limited to 'std/permissions/test.ts')
-rw-r--r--std/permissions/test.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/std/permissions/test.ts b/std/permissions/test.ts
new file mode 100644
index 000000000..2c96dfea1
--- /dev/null
+++ b/std/permissions/test.ts
@@ -0,0 +1,47 @@
+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+
+import { grant, grantOrThrow } from "./mod.ts";
+import { assert, assertEquals } from "../testing/asserts.ts";
+
+const { test } = Deno;
+
+test({
+ name: "grant basic",
+ async fn() {
+ assertEquals(await grant({ name: "net" }, { name: "env" }), [
+ { name: "net" },
+ { name: "env" }
+ ]);
+ }
+});
+
+test({
+ name: "grant array",
+ async fn() {
+ assertEquals(await grant([{ name: "net" }, { name: "env" }]), [
+ { name: "net" },
+ { name: "env" }
+ ]);
+ }
+});
+
+test({
+ name: "grant logic",
+ async fn() {
+ assert(await grant({ name: "net" }));
+ }
+});
+
+test({
+ name: "grantOrThrow basic",
+ async fn() {
+ await grantOrThrow({ name: "net" }, { name: "env" });
+ }
+});
+
+test({
+ name: "grantOrThrow array",
+ async fn() {
+ await grantOrThrow([{ name: "net" }, { name: "env" }]);
+ }
+});