Sinon-Chai Flashcards
These chainers are used on assertions with cy.stub() and cy.spy().
called
expect(spy).to.be.called
callCount
expect(spy).to.have.callCount(n)
calledOnce
expect(spy).to.be.calledOnce
calledTwice
expect(spy).to.be.calledTwice
calledThrice
expect(spy).to.be.calledThrice
calledBefore
expect(spy1).to.be.calledBefore(spy2)
calledAfter
expect(spy1).to.be.calledAfter(spy2)
calledWithNew
expect(spy).to.be.calledWithNew
alwaysCalledWithNew
expect(spy).to.always.be.calledWithNew
calledOn
expect(spy).to.be.calledOn(context)
alwaysCalledOn
expect(spy).to.always.be.calledOn(context)
calledWith
expect(spy).to.be.calledWith(…args)
alwaysCalledWith
expect(spy).to.always.be.calledWith(…args)
calledWithExactly
expect(spy).to.be.calledWithExactly(…args)
alwaysCalledWithExactly
expect(spy).to.always.be.calledWithExactly(…args)