MCPcopy Create free account
hub / github.com/bytebase/bytebase / createMockStorage

Function createMockStorage

frontend/src/utils/storage-migrate.test.ts:17–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15const MIGRATION_MARKER = "bb.storage-migration-v1";
16
17function createMockStorage(): Storage {
18 let store: Record<string, string> = {};
19 return {
20 get length() {
21 return Object.keys(store).length;
22 },
23 key(index: number) {
24 return Object.keys(store)[index] ?? null;
25 },
26 getItem(key: string) {
27 return store[key] ?? null;
28 },
29 setItem(key: string, value: string) {
30 store[key] = String(value);
31 },
32 removeItem(key: string) {
33 delete store[key];
34 },
35 clear() {
36 store = {};
37 },
38 };
39}
40
41let mockStorage: Storage;
42

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected