3 category: JavaScript libraries
7 * [Sinon-chai](https://github.com/domenic/sinon-chai)
13 var sinon = require('sinon');
14 require('chai').use(require('sinon-chai'));
20 expect(spy).calledOnce
21 expect(spy).calledTwice
22 expect(spy).calledThrice
23 expect(spy).calledBefore
24 expect(spy).calledAfter
25 expect(spy).calledWithNew
26 expect(spy).alwaysCalledWithNew
28 expect(spy).alwaysCalledOn
29 expect(spy).calledWith
30 expect(spy).alwaysCalledWith
31 expect(spy).calledWithExactly
32 expect(spy).alwaysCalledWithExactly
33 expect(spy).calledWithMatch
34 expect(spy).alwaysCalledWithMatch
36 expect(spy).alwaysReturned
38 expect(spy).alwaysThrew
42 spy.should.have.been.called
43 spy.should.have.been.calledOnce
44 spy.should.have.been.calledTwice
45 spy.should.have.been.calledThrice
46 spy1.should.have.been.calledBefore(spy2)
47 spy1.should.have.been.calledAfter(spy2)
48 spy.should.have.been.calledWithNew
49 spy.should.always.have.been.calledWithNew
50 spy.should.have.been.calledOn(context)
51 spy.should.always.have.been.calledOn(context)
52 spy.should.have.been.calledWith(...args)
53 spy.should.always.have.been.calledWith(...args)
54 spy.should.always.have.been.calledWithExactly(...args)
55 spy.should.always.have.been.calledWithExactly(...args)
56 spy.should.have.been.calledWithMatch(...args)
57 spy.should.always.have.been.calledWithMatch(...args)
58 spy.should.have.returned(returnVal)
59 spy.should.have.always.returned(returnVal)
60 spy.should.have.thrown(errorObjOrErrorTypeStringOrNothing)
61 spy.should.have.always.thrown(errorObjOrErrorTypeStringOrNothing)