Closed dominykas closed 6 years ago
Had a quick look and figured hey - if and object's method is the same, then it matches, and if it isn't - then it doesn't. But apparently all functions are treated as matchers, even when they're nested: https://github.com/dominykas/samsam/blob/master/test/samsam-test.js#L326
I could implement it so that if the matcher property is a function, and the object property is a function, and they're both the same function - it matches, and if it's not the same function - use it as a matcher. But wouldn't this be kind of too magic?
In short the options are:
stalebot-ing myself.
This is in the light of reviewing results of the fix for https://github.com/busterjs/buster/issues/64
assert.match
will try to useassert.match
on every property of the objects. Which means that if said property is a function - it will callassert.match(actualObj[someProp], expectedObj[someProp])
. IfexpectedObj[someProp]
is a function,match
will call that function:var fn = expectedObj[someProp]; fn(actualObj[someProp])
... That's just a bad idea, as you may imagine :)Just opening up a discussion for now. Head is busy with too many things, to suggest a good solution for now.