diff options
author | Andy Finch <andyfinch7@gmail.com> | 2019-12-05 15:30:20 -0500 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-12-05 15:30:20 -0500 |
commit | 7c3b9b4f4f2f4ec8fdeb0e77bb853fd22ffaa476 (patch) | |
tree | aeafe5cc2560c5366704d7a580a5b0e0dced504d /cli/js/permissions_test.ts | |
parent | 214b3eb29aa9cce8a55a247b4bd816cbd19bfe6b (diff) |
feat: first pass at native plugins (#3372)
Diffstat (limited to 'cli/js/permissions_test.ts')
-rw-r--r-- | cli/js/permissions_test.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cli/js/permissions_test.ts b/cli/js/permissions_test.ts index d9ba538f0..a50718652 100644 --- a/cli/js/permissions_test.ts +++ b/cli/js/permissions_test.ts @@ -7,11 +7,12 @@ const knownPermissions: Deno.PermissionName[] = [ "write", "net", "env", + "plugin", "hrtime" ]; -for (const grant of knownPermissions) { - testPerm({ [grant]: true }, async function envGranted(): Promise<void> { +function genFunc(grant: Deno.PermissionName): () => Promise<void> { + const gen: () => Promise<void> = async function Granted(): Promise<void> { const status0 = await Deno.permissions.query({ name: grant }); assert(status0 != null); assertEquals(status0.state, "granted"); @@ -19,7 +20,14 @@ for (const grant of knownPermissions) { const status1 = await Deno.permissions.revoke({ name: grant }); assert(status1 != null); assertEquals(status1.state, "prompt"); - }); + }; + // Properly name these generated functions. + Object.defineProperty(gen, "name", { value: grant + "Granted" }); + return gen; +} + +for (const grant of knownPermissions) { + testPerm({ [grant]: true }, genFunc(grant)); } test(async function permissionInvalidName(): Promise<void> { |