Why this matters now
HomeScreen is the first screen users land on after authentication and the primary engagement loop surface (streak, recent activity, earnings). It integrates five stores (userStore, activityStore, walletStore), useProofSubmit (for offline sync), and EarningsSummary. It has no test file. Any regression in how activities render, how the streak is displayed, or how the PendingProofsBanner triggers sync is invisible.
Problem / What
src/screens/HomeScreen.tsx (250 lines) has no test file. The screen:
Key Challenges
useProofSubmit calls loadQueue() synchronously in its initializer — the mock must stub proofQueue.loadQueue to return a controlled array.
recomputeStreaks must be called on mount; test with jest.fn() to verify the call.
- Activity status styling (confirmed=green, pending=yellow, failed=red) is a critical correctness concern — snapshot or explicit style assertion is needed.
Acceptance Criteria
Relevant files / functions
src/screens/HomeScreen.tsx
src/store/activityStore.ts
src/store/userStore.ts
src/hooks/useProofSubmit.ts — mock
src/services/proofQueue.ts — mock loadQueue
Out of scope
EarningsSummary internal rendering (tested separately in components.test.tsx).
- The sync retry flow (tested in
useProofSubmit.test.tsx).
Why this matters now
HomeScreenis the first screen users land on after authentication and the primary engagement loop surface (streak, recent activity, earnings). It integrates five stores (userStore,activityStore,walletStore),useProofSubmit(for offline sync), andEarningsSummary. It has no test file. Any regression in how activities render, how the streak is displayed, or how thePendingProofsBannertriggers sync is invisible.Problem / What
src/screens/HomeScreen.tsx(250 lines) has no test file. The screen:activities,streak,bestStreakfromactivityStorerecomputeStreaks()on mountEarningsSummary(which has its own useMemo gaps, per issue [Performance]EarningsSummarytriple O(n) computation on every render with no memoization #57)PendingProofsBannerwithpendingCount/isSyncingfromuseProofSubmitKey Challenges
useProofSubmitcallsloadQueue()synchronously in its initializer — the mock must stubproofQueue.loadQueueto return a controlled array.recomputeStreaksmust be called on mount; test withjest.fn()to verify the call.Acceptance Criteria
HomeScreen.test.tsxcreated with tests for: greeting text rendering, profile name fromuserStore, streak value fromactivityStore, last-5-activities rendering with correct status labels,PendingProofsBannershown whenpendingCount > 0,recomputeStreakscalled on mount, "Browse Tasks" button navigates toTaskstab.Relevant files / functions
src/screens/HomeScreen.tsxsrc/store/activityStore.tssrc/store/userStore.tssrc/hooks/useProofSubmit.ts— mocksrc/services/proofQueue.ts— mockloadQueueOut of scope
EarningsSummaryinternal rendering (tested separately incomponents.test.tsx).useProofSubmit.test.tsx).