Skip to content

[Testing] Zero test coverage for SubmitProofScreen — the core proof submission flow #81

Description

@cybermax4200

Why this matters now: SubmitProofScreen.tsx is the most complex screen in the app: it manages camera permissions, photo capture, GPS location, proof submission, activity creation, impact stat updates, proof status polling, and notification scheduling. It has 364 lines of business logic with zero tests. A regression here silently breaks the core value loop: task → proof → reward.

Problem / What: src/screens/SubmitProofScreen.tsx (364 lines) — no test file. The screen orchestrates useCameraPermission, useLocation, useProofSubmit, useProofStatus, useActivityStore, useUserStore, and scheduleLocalNotification.

Key Challenges:

  • Mock react-native-vision-camera: useCameraPermission, useCameraDevice, Camera.
  • Mock useLocation, useProofSubmit, useProofStatus.
  • Mock useActivityStore, useUserStore.
  • Mock scheduleLocalNotification.
  • Test: photo capture flow (permission → capture → preview).
  • Test: successful submission → activity created → stats updated → notification fired.
  • Test: offline submission → activity queued → error displayed.
  • Test: retake photo resets state correctly.
  • Test: no task ID shows EmptyState.
  • Test: location error display.

Acceptance Criteria:

  • Test file src/__tests__/SubmitProofScreen.test.tsx with 12+ test cases.
  • Camera capture flow.
  • Successful proof submission with activity and stat updates.
  • Offline/queued submission.
  • Retake photo state reset.
  • Empty state when no taskId.
  • All tests pass with npm test.

Relevant files/functions:

  • src/screens/SubmitProofScreen.tsx (entire file)
  • src/__tests__/SubmitProofScreen.test.tsx (new)

Out of scope: Real camera integration, IPFS pinning.

Labels: testing, advanced, screens

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions