- Hello again,
and welcome to Lesson 2.
This lesson is all about Jest matchers.
Jest matchers are functions in the Jest library
that enable you to write tests concisely and expressively.
We'll begin with a look at matchers
for test inequality, range, and null,
undefined, not a number, and true and false.
Then we'll see how to use Jest matchers
to test properties in objects
and how to test the elements in a collection.
We'll also see how to test for errors.
If we call a function
and expect an error to occur,
we can test that the function did actually cause
the error to occur.
At the end of the lesson,
we'll see how to extend the Jest matcher library
by writing our own custom matchers,
for example, to test if a string is a valid postcode
or something like that.