It would be convenient to have a function for
spy.called(6).times // returns true if spy have been called 6 times
Than I can use sinon-chai
spy.should.have.been.called(6).times
And of course spy.called
without function call should work as today
Use spy.callCount
to check the number of calls.
@cjohansen There is a reason I use spy.calledTwice
instead of spy.callCount === 2
, because it is more readable. (Also it would play well with sinon-chai). Though I should maybe file the issue on sinon-chai
repo instead.
Most helpful comment
Use
spy.callCount
to check the number of calls.