MathieuFedrigo / rn-test-navigation

A simple complete example of how to test navigation in React Native.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native - test navigation

The ultimate guide on how to test the navigation in React native.

Run project in development

  • Setting up the development environment: https://reactnative.dev/docs/environment-setup.

  • Install dependencies: yarn install

  • Run on Android/iOS/Real device: expo start

  • Run all test: yarn test

  • Run all test with coverage: yarn test:coverage

All kinds of tests

Here are all the possible test you can run:

  • Unit tests:
    • Basic navigate test with navigation mocked locally πŸ‘‰ src/tests/unit/Home.component.test.tsx
  • Integration tests:
    • Navigation between pages πŸ‘‰ src/tests/integration/navigation-between-pages.test.tsx
    • Interaction with nav header & nav params πŸ‘‰ src/tests/integration/navigation-header-and-params.test.tsx
    • useFocusEffect test πŸ‘‰ src/tests/integration/useFocusEffect-view-counter.test.tsx

The full standard can be found here.

About

A simple complete example of how to test navigation in React Native.


Languages

Language:TypeScript 35.7%Language:Java 32.4%Language:Objective-C 19.0%Language:Starlark 7.2%Language:JavaScript 3.2%Language:Ruby 2.5%