Topics:
- Unit Testing
Jest
Welcome to the wonderful world of automated testing, specifically unit testing. Whether this is immediately clear to you or not, you have already familiarized yourselves with this process, only, the tests have been written for you beforehand.
Now we start on the other side of the fence, where you have no tests, only working code. The goal of this sprint is to get you familiar with writing unit tests for JavaScript code.
- Use
yarn
to install the necessary dependencies from thepackage.json
file. - type
yarn test
to start the test runner. - open the
basic-javascript
folder and useproject-1.spec.js
to write tests for the functions insideproject-1.js
. - use
project-2.spec.js
to write tests for the functions insideproject-2.js
.
As you write your tests, bugs in the code may be revealed, feel free to correct and refactor the source code to sitisfy your tests.
Open the advanced-javascript
folder and write tests for the arrays.js
and object.js
files inside the corresponding *.spec.js
files.