Skip to content

Template to use react-native, msw, @testing-library/react-native for testing

Notifications You must be signed in to change notification settings

lewiscasewell/react-native-testing-template

Repository files navigation

React-native with MSW, Jest, React Query and React Testing Library

Description

This is a simple project template to demonstrate how to use MSW with React Native. It uses Jest and React Testing Library to test the application.

This application also has @tanstack/react-query to show how to use MSW with react-query for async state management and how I would typically test this in my application, including testing the rendering logic as well as isolating the useQuery or useMutation hooks in a test.

Installation

  1. Clone the repository
  2. Run yarn install
  3. Run yarn start
  4. Run yarn android or yarn ios

Testing

  1. Run yarn test
  2. Run yarn test:cov to generate a coverage report, example below
Screenshot 2023-11-24 at 16 58 47

Example app demo https://github.com/lewiscasewell/react-native-msw-template/assets/64678409/46512e9b-7c4a-4503-b345-5c81ebfd7727

About

Template to use react-native, msw, @testing-library/react-native for testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published