Ensures that value is an Array or Set and contains an item equal to the expected.
Array
Set
For objects, this method recursively checks equality of all fields, rather than comparing objects by reference as performed by expect(value).toContain(expected).
For primitive values, this method is equivalent to expect(value).toContain(expected).
Usage
const value = [ { example: 1 }, { another: 2 }, { more: 3 },];expect(value).toContainEqual({ another: 2 });expect(new Set(value)).toContainEqual({ another: 2 }); Copy
const value = [ { example: 1 }, { another: 2 }, { more: 3 },];expect(value).toContainEqual({ another: 2 });expect(new Set(value)).toContainEqual({ another: 2 });
Internal options that provide extra context for the matcher.
Received value.
Expected value in the collection.
Ensures that value is an
ArrayorSetand contains an item equal to the expected.For objects, this method recursively checks equality of all fields, rather than comparing objects by reference as performed by expect(value).toContain(expected).
For primitive values, this method is equivalent to expect(value).toContain(expected).
Usage