]> zoso.dev Git - libnemo.git/commitdiff
Fix length and add clear properties to sessionStorage mock.
authorChris Duncan <chris@zoso.dev>
Sun, 13 Oct 2024 09:15:55 +0000 (02:15 -0700)
committerChris Duncan <chris@zoso.dev>
Sun, 13 Oct 2024 09:15:55 +0000 (02:15 -0700)
test/TEST_VECTORS.js

index f261a1c5886958faa6b4426056aa16962fae321d..393c09cfcf32945a382492385d73ddbc333df977 100644 (file)
@@ -5,10 +5,11 @@ export const STORAGE = (() => {
        const _sessionStorage = {}
        Object.defineProperty(globalThis, 'sessionStorage', {
                value: {
-                       length: Object.getOwnPropertyNames(_sessionStorage).length,
+                       length: Object.entries().length,
                        setItem: (key, value) => _sessionStorage[key] = value,
                        getItem: (key) => _sessionStorage[key],
-                       removeItem: (key) => delete _sessionStorage[key]
+                       removeItem: (key) => delete _sessionStorage[key],
+                       clear: () => _sessionStorage = {}
                },
                configurable: true,
                enumerable: true