This project was bootstrapped with Create React App.
This is a sample project to explore React Testing Library(RTL).
To run tests
$ npm test
This command will run all test files wherever it is within the project folder.
The format of test file is ComponentName.test.js
.
For mocking API remote access, I used msw. See Greeting2.test.js
, User.test.js
and Users.test.js
test files for reference.
Clone the repository, install the dependencies and run
$ git clone https://github.com/supershaneski/react-test-sample.git myproject
$ cd myproject
$ npm install
$ npm start
Your browser will open to http://localhost:3000/
or some other port depending on the availability.