()
| 3 | import { useNotification } from '../src/composables/client/useNotification'; |
| 4 | |
| 5 | function createMemoryStorage(): Storage { |
| 6 | const data = new Map<string, string>(); |
| 7 | return { |
| 8 | get length() { |
| 9 | return data.size; |
| 10 | }, |
| 11 | clear() { |
| 12 | data.clear(); |
| 13 | }, |
| 14 | getItem(key: string) { |
| 15 | return data.get(key) ?? null; |
| 16 | }, |
| 17 | key(index: number) { |
| 18 | return Array.from(data.keys()).at(index) ?? null; |
| 19 | }, |
| 20 | removeItem(key: string) { |
| 21 | data.delete(key); |
| 22 | }, |
| 23 | setItem(key: string, value: string) { |
| 24 | data.set(key, value); |
| 25 | }, |
| 26 | }; |
| 27 | } |
| 28 | |
| 29 | function installStorage(storage: Storage): void { |
| 30 | Object.defineProperty(globalThis, 'localStorage', { |
no outgoing calls
no test coverage detected