Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 987 Bytes

README.md

File metadata and controls

46 lines (34 loc) · 987 Bytes

React Testing Examples

This repository contains some examples about using the Testing Library to test React components and hooks.

The Example App

This small application shows Bitcoin prices fetched from the Coindeks API. You can run the app using the following commands

$ npm i
$ npm start

The Tests

You'll find the test files in:

└── src
    ├── App.int.test.js
    ├── components
    │   └── PriceDisplay.unit.test.js
    └── hooks
        └── useBtcPrice.unit.test.js

The .int.test.js files are integration tests, the .unit.test.js files contain integration tests.

You can use the following command to run all or some tests:

$ npm test
$ npm run test:unit
$ npm run test:int

You can also use the following commands to view the code coverage:

$ npm run test:coverage
$ npm run test:coverage:unit
$ npm run test:coverage:int