Quiz Yourself on Matchers

This quiz will test what you have learned in this chapter.


A test uses the toBe matcher to test the result of a function call. However, the test is unexpectedly failing. What do you think the problem is, and how can it be resolved?

  success: true,
  productId: 1,

The toBe matcher will check that the objects’ references are equivalent, which won’t be the case. The toStrictEqual or toEqual functions could be used instead.


The expected object’s properties are ordered incorrectly. The productId needs to be placed before success.


The toBe function can’t be used to check objects, so toBeObj should be used instead.

Question 1 of 80 attempted

Get hands-on with 1200+ tech skills courses.