MCPcopy Index your code
hub / github.com/bytebase/bytebase / createMockStorage

Function createMockStorage

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

Source from the content-addressed store, hash-verified

2import { migrateUserStorage } from "./storage-migrate";
3
4function createMockStorage(): Storage {
5 let store: Record<string, string> = {};
6 return {
7 get length() {
8 return Object.keys(store).length;
9 },
10 key(index: number) {
11 return Object.keys(store)[index] ?? null;
12 },
13 getItem(key: string) {
14 return store[key] ?? null;
15 },
16 setItem(key: string, value: string) {
17 store[key] = String(value);
18 },
19 removeItem(key: string) {
20 delete store[key];
21 },
22 clear() {
23 store = {};
24 },
25 };
26}
27
28let mockStorage: Storage;
29

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected