From f694619341ee4f71072deda0ca90ba61a14bd768 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 13 Oct 2024 02:15:55 -0700 Subject: [PATCH] Fix length and add clear properties to sessionStorage mock. --- test/TEST_VECTORS.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.34.1