2021-01-10 21:59:07 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
2020-03-19 06:32:49 -04:00
|
|
|
import { grant, grantOrThrow } from "./mod.ts";
|
|
|
|
import { assert, assertEquals } from "../testing/asserts.ts";
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-03-19 06:32:49 -04:00
|
|
|
name: "grant basic",
|
|
|
|
async fn() {
|
|
|
|
assertEquals(await grant({ name: "net" }, { name: "env" }), [
|
|
|
|
{ name: "net" },
|
2020-03-28 13:03:49 -04:00
|
|
|
{ name: "env" },
|
2020-03-19 06:32:49 -04:00
|
|
|
]);
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2020-03-19 06:32:49 -04:00
|
|
|
});
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-03-19 06:32:49 -04:00
|
|
|
name: "grant array",
|
|
|
|
async fn() {
|
|
|
|
assertEquals(await grant([{ name: "net" }, { name: "env" }]), [
|
|
|
|
{ name: "net" },
|
2020-03-28 13:03:49 -04:00
|
|
|
{ name: "env" },
|
2020-03-19 06:32:49 -04:00
|
|
|
]);
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2020-03-19 06:32:49 -04:00
|
|
|
});
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-03-19 06:32:49 -04:00
|
|
|
name: "grant logic",
|
|
|
|
async fn() {
|
|
|
|
assert(await grant({ name: "net" }));
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2020-03-19 06:32:49 -04:00
|
|
|
});
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-03-19 06:32:49 -04:00
|
|
|
name: "grantOrThrow basic",
|
|
|
|
async fn() {
|
|
|
|
await grantOrThrow({ name: "net" }, { name: "env" });
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2020-03-19 06:32:49 -04:00
|
|
|
});
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-03-19 06:32:49 -04:00
|
|
|
name: "grantOrThrow array",
|
|
|
|
async fn() {
|
|
|
|
await grantOrThrow([{ name: "net" }, { name: "env" }]);
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2020-03-19 06:32:49 -04:00
|
|
|
});
|