mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
Merge deno_cli_snapshots into deno_cli (#3064)
This commit is contained in:
parent
9049213867
commit
b81e5db17a
148 changed files with 38 additions and 83 deletions
28
cli/js/permissions_test.ts
Normal file
28
cli/js/permissions_test.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { testPerm, assert, assertEquals } from "./test_util.ts";
|
||||
|
||||
const knownPermissions: Deno.Permission[] = [
|
||||
"run",
|
||||
"read",
|
||||
"write",
|
||||
"net",
|
||||
"env",
|
||||
"hrtime"
|
||||
];
|
||||
|
||||
for (const grant of knownPermissions) {
|
||||
testPerm({ [grant]: true }, function envGranted(): void {
|
||||
const perms = Deno.permissions();
|
||||
assert(perms !== null);
|
||||
for (const perm in perms) {
|
||||
assertEquals(perms[perm], perm === grant);
|
||||
}
|
||||
|
||||
Deno.revokePermission(grant);
|
||||
|
||||
const revoked = Deno.permissions();
|
||||
for (const perm in revoked) {
|
||||
assertEquals(revoked[perm], false);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue