summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-11-14 15:01:15 +0900
committerGitHub <noreply@github.com>2023-11-14 07:01:15 +0100
commit886652156e0e548a44fd41b293916bf37594eaa3 (patch)
tree4d8c98e9a98519d9dddd78fc1e1a7aa83bb59722 /cli/tests
parente54e8d4e2246de13325114b930effa8647623795 (diff)
fix(ext/web): webstorage has trap for symbol (#21090)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/webstorage_test.ts14
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);
+});