Skip to content
Fake newsletter app to show how to write tests with react-native-testing-library
TypeScript Objective-C JavaScript Ruby Python Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

The app

It is a single screen app where you can enter an email to subscribe to a newsletter. If you enter a valid email, you have a success message but if your email is badly formatted, you'll receive an error message. For simplicity's sake, the api used does not really subscribe you to any newsletter, it only checks whether the email given is valid or not.

Architecture of the project

This project contains two different versions of the same app :

  • a basic version: using nothing but internal state and basic components
  • a complex version: using formik, redux and sagas

To switch versions, go to the index and use the App component corresponding to the version you want to use

Install the app

Clone the repo and then, at its root, run yarn or npm i

To run it on ios

Then open up a simulator or connect a real device and run at the root of the project:

cd ios
pod install
cd ..
react-native run-ios

To run it on android

Then open up a simulator or connect a real device and run at the root of the project:

react-native run-android


Write the first test

Go to this file and follow this article

Run the tests

Just run yarn jest. You can add --coverage to find out how much code the tests cover

You can’t perform that action at this time.