Install Node and run these two commands within the terminal
Example 1 (toBe)
Let’s do some simple arithmetics. These two pages of code tell us that when we add 2 (num1) and 2 (num2) together we expect the result of 4.
we get this.
If we change the parameter around so that the numbers don’t add up we should get an error message when we run jest again.
Example 2 (toBeNull matches only null)
Should pass because is null = is null
Example 3 (Check for falsy values)
All 3 values (null, 0, undefined) will pass as falsy values
Example 4 (toEqual used for objects and arrays)
Jim Halpert will pass because it is an object and “toEqual” will compare the values.
Example 5 (toBeLessThanOrEqual)
This will pass because 800 + 800 is equal to 1600.
Example 6 (Regular Expression)
This will pass because there is no “I” in “team”.
Example 7 (Arrays)
This will pass because there is ‘admin’ within the array..
Example 8 (Async Functions)
This will pass because the jsonplaceholder is returning Leanne Graham..