expect({ id: 1 }).toEqual({ id: 1 })toEqual passes, because it compares values recursively. toBe uses Object.is, which checks identity. So two different objects or arrays are never equal with toBe, even with the same contents. That rules out both toBe options. The toStrictEqual option is the tempting one, but it fails. toStrictEqual treats a property set to undefined as different from a missing property.
Read more