Replies: 3 comments 9 replies
-
Looking at the commit history, this one might be in the domain of @mroderick, so maybe he knows if there has been a regression at some point. I am not all that familiar, but I do get why you wonder :) |
Beta Was this translation helpful? Give feedback.
-
@mroderick could you weigh in on this? I'm keen to use chai-samsam for mocha testing, but it uses a really old version of samsam, I think because of this discrepancy in behavior. TIA 🙏 |
Beta Was this translation helpful? Give feedback.
-
Yes, I remember introducing this due to the weird behaviour that the previous implementation had. One example is the array matching as described in the referee issue mentioned by @thom-nic . But there are actually more cases. Here is an example with strings: // This currently returns false, but it returns true with recursive matching
samsam.match({ test: 'something' }, { test: 'thing' }) I agree that with the examples given here, the current implementation looks broken. However, if deep recursive matching is really desired, I would rather introduce it as a new feature, e.g. |
Beta Was this translation helpful? Give feedback.
-
First, apologies for the samsam question here. The samsam repo doesn't have discussions enabled.
I'm trying to update chai-samsam which uses a very old version of samsam. I can't get @sinonjs/[email protected] (or v7,6,5) to do deep partial object matching.
Documentation for "Object matcher" states
However object property values don't seem "recursively" match - they need to be identical.
Arrays "recursively" work as one would expect - so long as you don't recurse into an object apparently:
So it seems this behavior has been around for a while, and probably why chai-samsam has never been updated to a newer version of samsam. That being the case: is there any way to get samsam to do actual recursive object matching?
Beta Was this translation helpful? Give feedback.
All reactions