2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-08-18 23:05:51 +08:00
|
|
|
import { unitTest, assertThrowsAsync } from "./test_util.ts";
|
2019-10-28 00:22:53 +09:00
|
|
|
|
2020-03-04 17:31:14 +01:00
|
|
|
unitTest(async function permissionInvalidName(): Promise<void> {
|
2020-08-18 23:05:51 +08:00
|
|
|
await assertThrowsAsync(async () => {
|
2020-07-13 18:23:24 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
await Deno.permissions.query({ name: "foo" as any });
|
2020-08-18 23:05:51 +08:00
|
|
|
}, Error);
|
2019-10-28 00:22:53 +09:00
|
|
|
});
|
|
|
|
|
2020-03-04 17:31:14 +01:00
|
|
|
unitTest(async function permissionNetInvalidUrl(): Promise<void> {
|
2020-08-18 23:05:51 +08:00
|
|
|
await assertThrowsAsync(async () => {
|
2020-07-13 18:23:24 +02:00
|
|
|
await Deno.permissions.query({ name: "net", url: ":" });
|
2020-08-18 23:05:51 +08:00
|
|
|
}, URIError);
|
2019-10-28 00:22:53 +09:00
|
|
|
});
|