/* * Stub for @react-native-async-storage/async-storage. The real package * references `window` at module load, which is undefined in Vitest's node * environment. The package ships an official jest mock, but it relies on the * `jest` global, so we provide a small in-memory implementation instead. * * Aliased in place of @react-native-async-storage/async-storage via * resolve.alias in vitest.config.ts. Test-reachable code only uses * getItem/setItem/removeItem. */ const store = new Map() const AsyncStorage = { getItem(key: string): Promise { return Promise.resolve(store.has(key) ? store.get(key)! : null) }, setItem(key: string, value: string): Promise { store.set(key, value) return Promise.resolve() }, removeItem(key: string): Promise { store.delete(key) return Promise.resolve() }, } export default AsyncStorage