Skip to content

test: add component test infrastructure #214

Description

@Chibuzor-Nwemambu

Background

Flagged during the Divider PR review (#207) — there is currently no test infrastructure for components in the library. The absence of tests has been consistent with the existing convention, but as the library matures this needs to be addressed.

Decision

  • Set up test infrastructure for packages/components
  • Write tests for all existing components
  • Add test file creation to the new component workflow so tests are written alongside the component from the start, not as an afterthought

Test stack

  • Jest as the test runner — the mature option for React Native native-module mocking
  • React Native Testing Library (RNTL) for querying and interacting with components
  • jest-expo preset — covers mocks for Expo/RN native modules used by peer deps (expo-font, react-native-reanimated, react-native-gesture-handler, react-native-svg)
  • Behavior-focused tests (render/query/fireEvent/assert), not snapshot tests — snapshots churn noisily during the ongoing token/style migration and don't catch real behavioral regressions

Scope

Existing components to cover

  • Button
  • Badge
  • Divider
  • Input
  • Link
  • Search
  • TextArea
  • TextField
  • SelectionControls (Switch, Radio, Checkbox)
  • Typography
  • EDSProvider

New component workflow

Update the component creation script/workflow to scaffold a ComponentName.test.tsx file alongside the component, so every new component ships with a test file from day one.

PR breakdown

Work is split across multiple branches/PRs against this single issue rather than GitHub sub-issues. Checking items off here as each PR merges:

References

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions