diff options
Diffstat (limited to 'cli/tests/unit')
-rw-r--r-- | cli/tests/unit/webstorage_test.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cli/tests/unit/webstorage_test.ts b/cli/tests/unit/webstorage_test.ts index e6ca5bb88..9c71b6320 100644 --- a/cli/tests/unit/webstorage_test.ts +++ b/cli/tests/unit/webstorage_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // deno-lint-ignore-file no-explicit-any -import { assert, assertThrows } from "./test_util.ts"; +import { assert, assertEquals, assertThrows } from "./test_util.ts"; Deno.test({ permissions: "none" }, function webStoragesReassignable() { // Can reassign to web storages @@ -21,7 +21,7 @@ Deno.test(function webstorageSizeLimit() { Error, "Exceeded maximum storage size", ); - assert(localStorage.getItem("k") === null); + assertEquals(localStorage.getItem("k"), null); assertThrows( () => { localStorage.setItem("k".repeat(15 * 1024 * 1024), "v"); @@ -40,3 +40,13 @@ Deno.test(function webstorageSizeLimit() { "Exceeded maximum storage size", ); }); + +Deno.test(function webstorageProxy() { + localStorage.clear(); + localStorage.foo = "foo"; + assertEquals(localStorage.foo, "foo"); + const symbol = Symbol("bar"); + localStorage[symbol as any] = "bar"; + assertEquals(localStorage[symbol as any], "bar"); + assertEquals(symbol in localStorage, true); +}); |