mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 01:29:14 -05:00
44 lines
901 B
TypeScript
44 lines
901 B
TypeScript
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
import { grant, grantOrThrow } from "./mod.ts";
|
|
import { assert, assertEquals } from "../testing/asserts.ts";
|
|
|
|
Deno.test({
|
|
name: "grant basic",
|
|
async fn() {
|
|
assertEquals(await grant({ name: "net" }, { name: "env" }), [
|
|
{ name: "net" },
|
|
{ name: "env" },
|
|
]);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "grant array",
|
|
async fn() {
|
|
assertEquals(await grant([{ name: "net" }, { name: "env" }]), [
|
|
{ name: "net" },
|
|
{ name: "env" },
|
|
]);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "grant logic",
|
|
async fn() {
|
|
assert(await grant({ name: "net" }));
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "grantOrThrow basic",
|
|
async fn() {
|
|
await grantOrThrow({ name: "net" }, { name: "env" });
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "grantOrThrow array",
|
|
async fn() {
|
|
await grantOrThrow([{ name: "net" }, { name: "env" }]);
|
|
},
|
|
});
|