Overview
Zustand persist middleware rehydrates stores from MMKV on startup, but edge cases (partial data, version mismatch, corrupt JSON) are not tested. These scenarios can leave the app in an inconsistent state without any error being thrown.
Specifications
Features:
- Write tests for: empty storage (fresh install), partial schema (missing keys), version mismatch (migration needed), corrupt JSON
- Verify the store falls back to default state in each case
Tasks:
- Mock MMKV to return controlled data for each scenario
- Assert store state matches expected defaults after rehydration failure
- Confirm Sentry is called for corrupt data cases
Impacted Files:
src/store/createStore.ts
__tests__/storeHydration.test.ts (new)
Acceptance Criteria
- All four hydration edge cases are tested
- Store defaults are correct in every failure scenario
- Corrupt data triggers a Sentry error
Overview
Zustand persist middleware rehydrates stores from MMKV on startup, but edge cases (partial data, version mismatch, corrupt JSON) are not tested. These scenarios can leave the app in an inconsistent state without any error being thrown.
Specifications
Features:
Tasks:
Impacted Files:
src/store/createStore.ts__tests__/storeHydration.test.ts(new)Acceptance Criteria