diff options
Diffstat (limited to 'packages/anastasis-webui/tests/__mocks__/browserMocks.ts')
-rw-r--r-- | packages/anastasis-webui/tests/__mocks__/browserMocks.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/anastasis-webui/tests/__mocks__/browserMocks.ts b/packages/anastasis-webui/tests/__mocks__/browserMocks.ts new file mode 100644 index 000000000..5be8c3ce6 --- /dev/null +++ b/packages/anastasis-webui/tests/__mocks__/browserMocks.ts @@ -0,0 +1,21 @@ +// Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage +/** + * An example how to mock localStorage is given below 👇 + */ + +/* +// Mocks localStorage +const localStorageMock = (function() { + let store = {}; + + return { + getItem: (key) => store[key] || null, + setItem: (key, value) => store[key] = value.toString(), + clear: () => store = {} + }; + +})(); + +Object.defineProperty(window, 'localStorage', { + value: localStorageMock +}); */ |