Skip to content

chore(mobile-expo): Unit tests for data layer and critical components #97

@Ur-imazing

Description

@Ur-imazing

Background

The Expo watch app should have unit tests for the data layer (Experience/section mapping) and critical components so regressions are caught and behavior is documented. This issue adds those tests. Scope has been expanded to cover all 10 active section types.

Expected outcome

  • Unit tests for the Experience fetch and section data layer, covering mapping logic for all 10 section types.
  • Unit tests for critical UI or hooks (e.g. section renderer dispatch, nested content resolution).
  • Tests run in CI (see chore for CI); no flaky or environment-dependent tests in core paths.
  • E2E strategy can be documented as deferred if out of scope.

Acceptance criteria

  • Data layer tests: at least one test per fetch path (watch home, experience-by-slug) or mapping logic.
  • Mapping tests for each of the 10 section types: VideoHero, MediaCollection, CTA, Text, Video, BibleQuotesCarousel, RelatedQuestions, Card, Section, Container.
  • Nested content tests: Section → recursive content, Container → slots → recursive content.
  • MediaCollection variant tests (carousel, collection, grid, hero, player).
  • SectionDispatcher tests: correct component resolved for each __typename.
  • Tests run in CI (via Expo or Jest).
  • README or CONTRIBUTING updated with how to run tests.

Possible solution(s)

  1. Jest or Expo's test runner; mock GraphQL client in data layer tests.
  2. Keep tests colocated or in __tests__ under mobile/expo.
  3. Use the sample Experience (slug: easter, documentId: lr6luew6oh4hurag4n8s0ddz) as a fixture for integration-style mapping tests.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions