used to perform a comparisons between two objects or arrays
where the actual is a super-set of the expected. for example:
constexpected = { foo:'bar', baz:true } constactual = { foo:'bar', baz:true, meaning:42 } constres1 = equivalent(expected) .setActual(actual) .compare(); // returns `true` constres2 = equivalent(actual) .setActual(expected) .compare(); // returns `false` console.log(res2.failureString()); // 'actual.meaning' unset while 'expected.meaning' had a value
usage within a AftTest.verify function would look like:
constt = newAftTest('description', () =>null); awaitt.verify(() =>actualObject, equivalent(expectedObj, 6)); // succeeds if `actualObject` has matching properties and values to `expectedObject`
Parameters
expected: Record<string | number | symbol, any>
the expected value
maxDepth: number = Infinity
the maximum level to recurse into any object properties
used to perform a comparisons between two objects or arrays where the
actual
is a super-set of theexpected
. for example:usage within a
AftTest.verify
function would look like: