From 5252ff5dbd1e2adc9e38407be7ea50549612c543 Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Sun, 16 Oct 2022 19:33:17 +0200 Subject: fix(ext/cache): illegal constructor (#16205) --- cli/tests/unit/cache_api_test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli') 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); -- cgit v1.2.3