From a5bc290becffb464a228e6a008b9604ee6847122 Mon Sep 17 00:00:00 2001 From: Vojtech Szocs Date: Thu, 4 Jul 2019 18:05:22 +0200 Subject: [PATCH] Improve mock localStorage --- frontend/__mocks__/localStorage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/__mocks__/localStorage.ts b/frontend/__mocks__/localStorage.ts index e920671557d..c727e8312f0 100644 --- a/frontend/__mocks__/localStorage.ts +++ b/frontend/__mocks__/localStorage.ts @@ -1,11 +1,11 @@ let _localStorage = {}; (window as any).localStorage = (window as any).sessionStorage = { - setItem(key, value) { + setItem(key: string, value: string) { Object.assign(_localStorage, { [key]: value} ); }, - getItem(key) { - return _localStorage[key] || null; + getItem(key: string): string | null { + return _localStorage.hasOwnProperty(key) ? _localStorage[key] : null; }, clear() { _localStorage = {};