From: Chris Duncan Date: Sun, 13 Oct 2024 09:15:55 +0000 (-0700) Subject: Fix length and add clear properties to sessionStorage mock. X-Git-Tag: v0.0.9~2 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=f694619341ee4f71072deda0ca90ba61a14bd768;p=libnemo.git Fix length and add clear properties to sessionStorage mock. --- diff --git a/test/TEST_VECTORS.js b/test/TEST_VECTORS.js index f261a1c..393c09c 100644 --- a/test/TEST_VECTORS.js +++ b/test/TEST_VECTORS.js @@ -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