/** * Mock for react-native-mmkv in Vitest. * In-memory storage that mimics MMKV API. */ const store = new Map(); export class MMKV { private id: string; constructor(config?: { id?: string }) { this.id = config?.id ?? 'default'; } getString(key: string): string | undefined { const val = store.get(`${this.id}:${key}`); return typeof val === 'string' ? val : undefined; } set(key: string, value: string | number | boolean): void { store.set(`${this.id}:${key}`, value); } delete(key: string): void { store.delete(`${this.id}:${key}`); } contains(key: string): boolean { return store.has(`${this.id}:${key}`); } clearAll(): void { const prefix = `${this.id}:`; for (const key of store.keys()) { if (key.startsWith(prefix)) { store.delete(key); } } } getAllKeys(): string[] { const prefix = `${this.id}:`; return Array.from(store.keys()) .filter((k) => k.startsWith(prefix)) .map((k) => k.slice(prefix.length)); } }