toStrictEqual
Compare things in a nested fashion, strictly
This method uses the Reflect.equals()
function, which utilizes an AssemblyScript source transform to enable deep comparison of public
properties on class
es, Set
s and Map
s.
This expectation uses the Reflect.equals()
function. as-pect
knows how to compare each property and traverse through nested references and determine strict equality.
It can also loop over arrays and determine strict equality between arrays, maps, and sets. For example:
Note: the ==
operator can be overloaded, and this method will always check the ==
operation first before traversing down the object tree to compare nested values.
To speed up equality comparisons between references, it's possible to override the ==
operator like this:
This method should match jest
semantics and should be safe to use portably.
Last updated
Was this helpful?