I need to check that an Array contains an Object that matches a given structure.
I already tried this:
const myArray = [{ name: 'Mete', age: 19, phone: '123456' }];
expect(myArray).toEqual(
expect.arrayContaining([
expect.objectContaining({
name: 'Mete',
age: 19
})
])
)
// Throws no error
It should not match because the object in the array has an additional property "phone".
I need something like toStrictEqual() combined with arrayContaining().