Asserts that a value is deeply and strictly equal to what is expected.
There are two key differences from toEqual():
- It checks that the class is the same.
- It checks that
undefinedvalues match as well.
method
Asserts that a value is deeply and strictly equal to what is expected.
There are two key differences from toEqual():
undefined values match as well.the expected value
class Dog {
type = "dog";
}
const actual = new Dog();
expect(actual).toStrictEqual(new Dog());
expect(actual).toStrictEqual({ type: "dog" }); // fail