Is there a way to strictly test .objectConaining with jest?
Basically the code below checks for one of they object keys, and the tests passes, but i don't want it to pass.
Is there some sort of way to test this object strictly, like .toStrictEquals so that the test will not only check for specific keys but for the object structure as well?
it('should work', () => {
const spy = jest.fn();
const obj = {
hello: "world",
foo: "bar",
}
spy(obj);
expect(spy).toBeCalledWith( expect.objectContaining({
hello: expect.stringContaining("world")
}));
});
Basically my goal is to check for obj stricly.