You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add unit tests for the three Zustand state stores: auth-store.ts, course-store.ts, and error-store.ts.
Why
Stores contain critical business logic (authentication flow, enrollment deduplication, progress tracking) that is currently untested. Bugs in store logic could cause data loss, broken auth flows, or incorrect progress tracking.
What
Add unit tests for the three Zustand state stores:
auth-store.ts,course-store.ts, anderror-store.ts.Why
Stores contain critical business logic (authentication flow, enrollment deduplication, progress tracking) that is currently untested. Bugs in store logic could cause data loss, broken auth flows, or incorrect progress tracking.
Scope
src/store/__tests__/auth-store.test.tssrc/store/__tests__/course-store.test.tssrc/store/__tests__/error-store.test.tsAcceptance Criteria
auth-storetests: connect, disconnect, setJwt, applyRefreshedTokens, isTokenExpired, hydration, persistencecourse-storetests: enroll (deduplication), updateProgress (percent calculation), setEnrollments, getProgresserror-storetests: setError, clearError, setRetryuseAuthStore.getState()/useCourseStore.getState()patternsnpm testpassesTechnical Context
Files:
src/store/auth-store.ts— 158 lines, Zustand with persist middleware, handles wallet auth, JWT, token refreshsrc/store/course-store.ts— 79 lines, Zustand with persist, handles courses, enrollments, progresssrc/store/error-store.ts— 20 lines, Zustand (no persist), global error stateLabels: tests, react