How to expect an object containing specific properties in jest
expect.objectContaining()
matches an object containing specific properties and values.
test('object contains specific properties', () => {
const obj = { a: 1, b: 2, c: 3 };
expect(obj).toEqual(expect.objectContaining({
a: 1,
c: 3
}));
});