| class LocalStorageMock { | |
| store: { [key: string]: string }; | |
| constructor() { | |
| this.store = {}; | |
| } | |
| clear() { | |
| this.store = {}; | |
| } | |
| getItem(key: string) { | |
| return this.store[key] || null; | |
| } | |
| setItem(key: string, value: string) { | |
| this.store[key] = value; | |
| } | |
| removeItem(key: string) { | |
| delete this.store[key]; | |
| } | |
| } | |
| // @ts-ignore | |
| global.localStorage = new LocalStorageMock(); | |