[Git Hub!]: (https://github.com/jitendrak414/testing)
testing means checking that our code meets some expectations
unit testing integration testing UI testing
JavaScript library for creating, running, and structuring tests. Jest is a JavaScript test runner
Mostly Jest used with React
If you are try to writing web application
1. you should test all the pages
2. Every User interaction realated to page
3. pages are made from code having function and modueles
There is 2 things while writing your code
- legacy code which comes without tests
- implement a new functionality
Some Steps
- import the function to test
- give an input to the function
- define what to expect as the output
- check if the function produces the expected output
that's it.
Testing won't be scary anymore if you think in these terms: input - expected output - assert the result.
mkdir block1 && cd $_
npm init -y
Install Jest
npm i jest --save-dev
`npm install --save-dev jest-html-reporter`