Skip to content

[MEDIUM] Add mobile service layer and offline sync tests #104

Description

@kilodesodiq-arch

Engineering Gap

Mobile tests at app/mobile/src/__tests__/ cover render-only component tests. No tests for API service layer (api.ts, aidApi.ts), offline sync queue (syncQueue.ts), notification service, or cache services.

Codebase Evidence

  • app/mobile/src/__tests__/: 11 test files — all component render tests
  • app/mobile/src/services/api.ts: fetch-based API client with no test coverage
  • app/mobile/src/services/syncQueue.ts: Offline queue with no test
  • app/mobile/src/services/aidCache.ts: Cache logic with no test

Risk Profile

Current Risk

Offline sync failures in field operations undetected.

Business Impact

Field operators unable to submit claims offline. Aid distribution delayed.

Remediation Strategy

Add unit tests for API client with mocked fetch. Test sync queue with network on/off simulation. Test cache TTL and invalidation.

Success Conditions

  • API client tests with mocked fetch
  • Sync queue tests with network state changes
  • Cache TTL and invalidation tests

Change Surface

New test files in app/mobile/src/__tests__/ for services

Security Review

No security impact.

Completion Checklist

  • Implementation completed
  • Peer reviewed
  • Tests passing
  • Ready for merge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions