Making your code better, one test at a time.
- Practice creating tests and thinking of testing for small functions
- Understanding the advantages of testing
- Clone this repo
- Initialize an npm project inside the cloned repo with
npm init -y
- Install Jest as a development dependency
npm install -D jest
- Modify the
test
script inpackage.json
. To betest: "jest"
- Inspect the provided JavaScript functions.
- Create two files
objectFunctions.test.js
andlabFunctions.test.js
. - Read the function description and the tests suggestions in the function's comments.
- For each function write tests that verify the given function works as expected. Make sure to test with a few different inputs and
expect
the desired output - Group function's tests in
describe()
blocks. Onedescribe
block per function. - Run your tests with
npm test
Note:
- If you can think of any other test cases you want to add for any of the functions your are highly encouraged to add them.
- If you find any mistakes in the code provided, fix it.
Submit a pull request to this repo.