.toContainEqual(item)

Use .toContainEqual when you want to check that an item with a specific structure and values is contained in an array. For testing the items in the array, this matcher recursively checks the equality of all fields, rather than checking for object identity.

  1. describe('my beverage', () => {
  2. test('is delicious and not sour', () => {
  3. const myBeverage = {delicious: true, sour: false};
  4. expect(myBeverages()).toContainEqual(myBeverage);
  5. });
  6. });