Unit Testing with Jest
In order to do this activity, you must have completed the following:
PART 1
Notes from the (first) video
To install jest as a dev dependency
npm install jest --save-dev
Notice how it gets saved in package.json, in the devDependencies section.
To run the test:
npx jest .\tests\sample.test.js
Other quick notes before moving on:
- Jest makes heavy use of callbacks
- You can nest describe() calls to organize your tests for each function
- The it() function is an alias for the test() function
- Learn how to use it()/test() to run individual tests
- The expect() function
- Here's a reference on Jest matchers (toBe(), .not, toBeGreaterThan(), etc.)