Unit Testing
Last updated
Last updated
To view lecture notes for this course, please consult the .
Instructions for Unit Exercises: 1. Go to unit folder cd unit
2. Open program.test.js and go to each TODO block. 3. Complete each todo block by adding unit tests. 4. Please run the following script to npm run unit:test
in order to do the unit test exercises
For assert.equal(actual, expected, 'My message here')
if actual and expected are equal then the unit test will pass.
The map function behaves in the following manner
This will return the following structure
Add variables actual and expected to this first unit test. The equal method expects to get single property/value in order to pass 1 === 1 or "Mike" === "Mike" The deepEqual method does a deep property check like this [1,2,3] === [1,2,3]
The filter function behaves in the following manner
This will return the following structure [4, 5]
Either choose assert.equal
or assert.deepEqual
but remember deepEqual does a deep check with arrays but equal checks properties.
The concatAll function behaves in the following manner
This will return the following structure [1,2,3,4,5,6,7,8,9,10]
The concatMap function behaves in the following manner
This will return the following structure ["One", "Two", "Three", "Four", "Five", "Six"]