Jest: Basic matches

expect(42).toBe(42)Strict equality (===)
expect(42).not.toBe(3)Strict equality (!==)
expect([1, 2]).toEqual([1, 2])Deep equality
expect({ a: undefined, b: 2 }).toEqual({ b: 2 })Deep equality
expect({ a: undefined, b: 2 }).not.toStrictEqual({ b: 2 })Strict equality (Jest 23+)

Leave a Reply

Your email address will not be published. Required fields are marked *