React.js Testing Approaches - an overview
This repository aims to show and compare testing approaches you can have with testing React components:
- Testing the real markup rendered by React using
- Testing through test utilities (
- Testing with references and the real markup (an improvement to simple testing with the real markup)
- Testing with
- Testing using shallow rendering approach
It shows those testing techniques using three components:
Greetercomponent - a simple box with a "Hello, X!" paragraph. (intent: it is a dead easy example to follow)
SpecialityOfTheHousecomponent - a select box with three options to choose (intent: to show interaction with form inputs in tests)
InvitationListcomponent - a list of people invited for an event (intent: it is made of more than two components, so it can be shown what to test at the top-level and what not.)
Then, follow these steps:
git clone email@example.com:arkency/react-testing-approaches.git cd react-testing-approaches npm install -g grunt # You may need a root access for this. npm install
To run tests, simply run:
React Kung Fu
We're preparing something big for you. Since we love teaching React.js, we decided to create a whole new initiative called React Kung Fu.
The project is licensed under the free MIT license. You can read more about it in the LICENSE file.
This repository is funded and maintained by Arkency. Check out our other open-source projects.