Skip to content

Examples about how to test components and hooks in React using the Testing Library

Notifications You must be signed in to change notification settings

miguelgarcia/react-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Examples about how to test components and hooks in React using the Testing Library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published