summaryrefslogtreecommitdiff
path: root/cli/tests/unit/cache_api_test.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2022-10-16 19:33:17 +0200
committerGitHub <noreply@github.com>2022-10-16 23:03:17 +0530
commit5252ff5dbd1e2adc9e38407be7ea50549612c543 (patch)
tree69a0eb8289235b864e1ce2368838b471b47c994a /cli/tests/unit/cache_api_test.ts
parent07213dec94398aab687afd435ea506b362a6671a (diff)
fix(ext/cache): illegal constructor (#16205)
Diffstat (limited to 'cli/tests/unit/cache_api_test.ts')
-rw-r--r--cli/tests/unit/cache_api_test.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/tests/unit/cache_api_test.ts b/cli/tests/unit/cache_api_test.ts
index 7bc372003..7bca16d89 100644
--- a/cli/tests/unit/cache_api_test.ts
+++ b/cli/tests/unit/cache_api_test.ts
@@ -4,6 +4,7 @@ import {
assertEquals,
assertFalse,
assertRejects,
+ assertThrows,
} from "./test_util.ts";
Deno.test(async function cacheStorage() {
@@ -95,6 +96,13 @@ Deno.test(async function cacheApi() {
assertFalse(await caches.has(cacheName));
});
+Deno.test(function cacheIllegalConstructor() {
+ // @ts-expect-error illegal constructor
+ assertThrows(() => new Cache(), TypeError, "Illegal constructor");
+ // @ts-expect-error illegal constructor
+ assertThrows(() => new Cache("foo", "bar"), TypeError, "Illegal constructor");
+});
+
Deno.test(async function cachePutReaderLock() {
const cacheName = "cache-v1";
const cache = await caches.open(cacheName);