Sinon-Chai Flashcards

These chainers are used on assertions with cy.stub() and cy.spy().

1
Q

called

A

expect(spy).to.be.called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

callCount

A

expect(spy).to.have.callCount(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

calledOnce

A

expect(spy).to.be.calledOnce

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

calledTwice

A

expect(spy).to.be.calledTwice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

calledThrice

A

expect(spy).to.be.calledThrice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

calledBefore

A

expect(spy1).to.be.calledBefore(spy2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

calledAfter

A

expect(spy1).to.be.calledAfter(spy2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

calledWithNew

A

expect(spy).to.be.calledWithNew

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

alwaysCalledWithNew

A

expect(spy).to.always.be.calledWithNew

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

calledOn

A

expect(spy).to.be.calledOn(context)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

alwaysCalledOn

A

expect(spy).to.always.be.calledOn(context)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

calledWith

A

expect(spy).to.be.calledWith(…args)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

alwaysCalledWith

A

expect(spy).to.always.be.calledWith(…args)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

calledWithExactly

A

expect(spy).to.be.calledWithExactly(…args)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

alwaysCalledWithExactly

A

expect(spy).to.always.be.calledWithExactly(…args)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

calledWithMatch

A

expect(spy).to.be.calledWithMatch(…args)

17
Q

alwaysCalledWithMatch

A

expect(spy).to.always.be.calledWithMatch(…args)

18
Q

returned

A

expect(spy).to.have.returned(returnVal)

19
Q

alwaysReturned

A

expect(spy).to.have.always.returned(returnVal)

20
Q

threw

A

expect(spy).to.have.thrown(errorObjOrErrorTypeStringOrNothing)

21
Q

alwaysThrew

A

expect(spy).to.have.always.thrown(errorObjOrErrorTypeStringOrNothing)