Credit to devdocs.io
Back
Forward
Menu
Home
Clear search
sinon 3
API Mirror
3
sinon
26
Assertions
Assertions
sinon.assert.alwaysCalledOn()
sinon.assert.alwaysCalledWith()
sinon.assert.alwaysCalledWithExactly()
sinon.assert.alwaysCalledWithMatch()
sinon.assert.alwaysThrew()
sinon.assert.callCount()
sinon.assert.called()
sinon.assert.calledOn()
sinon.assert.calledOnce()
sinon.assert.calledThrice()
sinon.assert.calledTwice()
sinon.assert.calledWith()
sinon.assert.calledWithExactly()
sinon.assert.calledWithMatch()
sinon.assert.calledWithNew()
sinon.assert.callOrder()
sinon.assert.expose()
sinon.assert.fail()
sinon.assert.failException
sinon.assert.match()
sinon.assert.neverCalledWith()
sinon.assert.neverCalledWithMatch()
sinon.assert.notCalled()
sinon.assert.pass()
sinon.assert.threw()
6
Fake timers
clock.next()
clock.restore()
clock.runAll()
clock.tick()
Fake timers
sinon.useFakeTimers()
40
Fake XHR and server
autoRespond
autoRespondAfter()
Fake XHR and server
fakeHTTPMethods
FakeXMLHttpRequest.addFilter()
FakeXMLHttpRequest.useFilters
request.async
request.autoRespond
request.autoRespondAfter
request.error()
request.getAllResponseHeaders()
request.getResponseHeader()
request.method
request.password
request.requestBody
request.requestHeaders
request.respond()
request.responseXML
request.setResponseBody()
request.setResponseHeaders()
request.setStatus()
request.status
request.statusText
request.url
request.username
respondImmediately
server.autoRespond
server.autoRespondAfter
server.configure()
server.fakeHTTPMethods
server.getHTTPMethod()
server.requests
server.respond()
server.respondImmediately
server.respondWith()
server.restore()
sinon.createFakeServer()
sinon.createFakeServerWithClock()
xhr.onCreate
xhr.restore()
1
JSON-P
JSON-P
31
Matchers
Matchers
sinon.match()
sinon.match.any
sinon.match.array
sinon.match.array.contains()
sinon.match.array.deepEquals()
sinon.match.array.endsWith()
sinon.match.array.startsWith()
sinon.match.bool
sinon.match.date
sinon.match.defined
sinon.match.falsy
sinon.match.func
sinon.match.has()
sinon.match.hasNested()
sinon.match.hasOwn()
sinon.match.instanceOf()
sinon.match.map
sinon.match.map.contains()
sinon.match.map.deepEquals()
sinon.match.number
sinon.match.object
sinon.match.regexp
sinon.match.same()
sinon.match.set
sinon.match.set.contains()
sinon.match.set.deepEquals()
sinon.match.string
sinon.match.symbol
sinon.match.truthy
sinon.match.typeOf()
1
Migrating to v2.0
Migrating to v2.0
1
Migrating to v3.0
Migrating to v3.0
17
Mocks
expectation.atLeast()
expectation.atMost()
expectation.exactly()
expectation.never()
expectation.on()
expectation.once()
expectation.thrice()
expectation.twice()
expectation.verify()
expectation.withArgs()
expectation.withExactArgs()
mock.expects()
mock.restore()
mock.verify()
Mocks
sinon.expectation.create()
sinon.mock()
16
Sandboxes
sandbox.assert()
sandbox.mock()
sandbox.reset()
sandbox.resetBehavior()
sandbox.resetHistory()
sandbox.restore()
sandbox.spy()
sandbox.stub()
sandbox.useFakeServer()
sandbox.useFakeTimers()
sandbox.useFakeXMLHttpRequest()
sandbox.usingPromise()
sandbox.verify()
sandbox.verifyAndRestore()
Sandboxes
sinon.createSandbox()
51
Spies
Spies
spy.alwaysCalledOn()
spy.alwaysCalledWith()
spy.alwaysCalledWithExactly()
spy.alwaysCalledWithMatch()
spy.alwaysReturned()
spy.alwaysThrew()
spy.args
spy.callCount
spy.called
spy.calledAfter()
spy.calledBefore()
spy.calledImmediatelyAfter()
spy.calledImmediatelyBefore()
spy.calledOn()
spy.calledOnce
spy.calledThrice
spy.calledTwice
spy.calledWith()
spy.calledWithExactly()
spy.calledWithMatch()
spy.calledWithNew()
spy.exceptions
spy.firstCall
spy.getCall()
spy.getCalls()
spy.lastCall
spy.neverCalledWith()
spy.neverCalledWithMatch()
spy.notCalled
spy.printf()
spy.reset()
spy.restore()
spy.returned()
spy.returnValues
spy.secondCall
spy.thirdCall
spy.thisValues
spy.threw()
spy.withArgs()
spyCall.args
spyCall.calledOn()
spyCall.calledWith()
spyCall.calledWithExactly()
spyCall.calledWithMatch()
spyCall.exception
spyCall.notCalledWith()
spyCall.notCalledWithMatch()
spyCall.returnValue
spyCall.thisValue
spyCall.threw()
43
Stubs
sinon.addBehavior()
sinon.stub()
stub.callArg()
stub.callArgWith()
stub.callsArg()
stub.callsArgAsync()
stub.callsArgOn()
stub.callsArgOnAsync()
stub.callsArgOnWith()
stub.callsArgOnWithAsync()
stub.callsArgWith()
stub.callsArgWithAsync()
stub.callsFake()
stub.callThrough()
stub.get()
stub.onCall()
stub.onFirstCall()
stub.onSecondCall()
stub.onThirdCall()
stub.rejects()
stub.reset()
stub.resetBehavior()
stub.resetHistory()
stub.resolves()
stub.returns()
stub.returnsArg()
stub.returnsThis()
stub.set()
stub.throws()
stub.usingPromise()
stub.value()
stub.withArgs()
stub.yield()
stub.yields()
stub.yieldsAsync()
stub.yieldsOn()
stub.yieldsOnAsync()
stub.yieldsTo()
stub.yieldsToAsync()
stub.yieldsToOn()
stub.yieldsToOnAsync()
stub.yieldTo()
Stubs
5
Utilities
sinon.createStubInstance()
sinon.format()
sinon.log()
sinon.restore()
Utilities
sinon / Migrating to v3.0
Migrating to v3.0
Stackoverflow
Slideshare
Speakerdeck