I actually only wanted to quickly add sinon.match.defined and then start documenting, but then I couldn't resist writing an alternative to calledWith that uses sinon.match.like if the argument is a boolean, string, regexp or object. I'm sorry.
calledLike, alwaysCalledLike and neverCalledLike
Hehe, still on fire, eh? :) I think many of the examples are very interesting, but I am not convinced about this case:
That seems sort of confusing, don't you think?
Yes. I Reviewed the buster documentation for assert.match again and suppose you would prefer the same behaviour here, which makes sense. That would mean that booleans are compared strictly.
On the other hand, sinon.match.like should be fuzzy here. The function name could be missleading then.
Do you think spy.calledWithMatch would be a better fit? It could implement behaviour for numbers and functions according to buster as well.
I like that suggestion very much. In fact I've been meaning to write assert.calledWithMatch for buster for a while, having the functionality built into Sinon makes a lot more sense.
There are still two open points:
So the only issue is that Sinon's matcher treats true as truthy and Buster treats it as boolean true?
Apparently :) Do you like the idea of moving 'like' into 'match'? I'm happy to change all of this and update the pull request if you do.
I like that approach. Regarding true/truthy - I think that sinon.match.truthy is more explicit and less magic. What do you think?
Fair enough. Truthy sounds nice. I'll add that one as well then.
Merged sinon.match.like into sinon.match. Renamed calledLike to calle…
Fixed assertion messages.
Added sinon.match.truthy and sinon.match.falsy.
Oups! Synced the branch half way through. sinon.match needs to check for objects with a test function and numbers.
So I shouldn't pull this yet, right?
Correct. Almost there. Maybe I can finish tonight.
sinon.match works properly with numbers and uses a test function if f…
…ound in objects.
Now you can pull :-)
Sorry for the delay, I'm too far away from inbox 0...
Buster seems to keep you quite busy. Can you update the sinon-next.js and sinon-ie-next.js files?
Yeah, most of my open source time has been going into Buster lately. Sinon is still a priority though, it's just so much more complete than Buster, so need to bring Buster up to the same level :)
Updated the next files now. Also, I think I've figured out why the sinonjs.org server has been so fucking slow. Hopefully that problem is fixed now.