jest.mock('@react-native-async-storage/async-storage', () => { const storage = new Map(); return { __esModule: true, default: { getItem: jest.fn((key: string) => Promise.resolve(storage.get(key) ?? null)), removeItem: jest.fn((key: string) => { storage.delete(key); return Promise.resolve(); }), setItem: jest.fn((key: string, value: string) => { storage.set(key, value); return Promise.resolve(); }), }, }; }); import { createPersistOptions } from '../src/state/createPersistOptions'; type TestState = { hydrated: boolean; transientValue: string; }; describe('createPersistOptions', () => { it('creates named options with JSON storage and preserves extra options', () => { const options = createPersistOptions>({ name: 'test-state', partialize: state => ({ hydrated: state.hydrated }), version: 2, }); expect(options.name).toBe('test-state'); expect(options.version).toBe(2); expect(options.storage).toBeDefined(); expect(options.partialize?.({ hydrated: true, transientValue: 'skip' })).toEqual( { hydrated: true, }, ); }); });