Skip to content

[Testing] Zero test coverage for HomeScreen — activity feed rendering, streak display, pending proof sync, and EarningsSummary integration #148

Description

@cybermax4200

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

  • HomeScreen.test.tsx created with tests for: greeting text rendering, profile name from userStore, streak value from activityStore, last-5-activities rendering with correct status labels, PendingProofsBanner shown when pendingCount > 0, recomputeStreaks called on mount, "Browse Tasks" button navigates to Tasks tab.
  • All tests pass in CI.

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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions