In this blog post I’ll demonstrate how to use expect assertion library, assertion libraries let us make assertions about values types, whether an array contains certain elements etc.

You can find expect information and how to install it here:

https://github.com/mjackson/expect

We first need to load the expect library into out test suit.

Since in our test we are expecting to value to be a specific value I’m going to use toBe assertion which simply asserts that an object is strictly equal to a value as described below.

Here we can see out tests are still passing.

I’m going to make it fail to visualize error messages: