Credit to devdocs.io
Back
Forward
Menu
Home
Clear search
sinon 7
API Mirror
7
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()
41
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()
sinon.useFakeXMLHttpRequest()
xhr.onCreate
xhr.restore()
10
Fakes
f.callback
f.lastArg
Fakes
sinon.fake()
sinon.fake.rejects()
sinon.fake.resolves()
sinon.fake.returns()
sinon.fake.throws()
sinon.fake.yields()
sinon.fake.yieldsAsync()
1
General setup
General setup
1
JSON-P
JSON-P
34
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.every()
sinon.match.falsy
sinon.match.func
sinon.match.has()
sinon.match.hasNested()
sinon.match.hasOwn()
sinon.match.in()
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.some()
sinon.match.string
sinon.match.symbol
sinon.match.truthy
sinon.match.typeOf()
18
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.usingPromise()
mock.verify()
Mocks
sinon.expectation.create()
sinon.mock()
20
Sandboxes
sandbox.assert()
sandbox.createStubInstance()
sandbox.mock()
sandbox.replace()
sandbox.replaceGetter()
sandbox.replaceSetter()
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()
42
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.calledOnceWith()
spy.calledOnceWithExactly()
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.resetHistory()
spy.restore()
spy.returned()
spy.returnValues
spy.secondCall
spy.thirdCall
spy.thisValues
spy.threw()
spy.withArgs()
2
Spy call
Spy call
spyCall.lastArg
37
Stubs
sinon.addBehavior()
sinon.stub()
stub.callArg()
stub.callArgWith()
stub.callsArg()
stub.callsArgOn()
stub.callsArgOnWith()
stub.callsArgWith()
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.resolvesArg()
stub.returns()
stub.returnsArg()
stub.returnsThis()
stub.set()
stub.throws()
stub.usingPromise()
stub.value()
stub.withArgs()
stub.yield()
stub.yields()
stub.yieldsOn()
stub.yieldsRight()
stub.yieldsTo()
stub.yieldsToOn()
stub.yieldTo()
Stubs
2
Utilities
sinon.createStubInstance()
Utilities
sinon 7
Assertions
Fake timers
Fake XHR and server
Fakes
General setup
JSON-P
Matchers
Mocks
Sandboxes
Spies
Spy call
Stubs
Utilities
Stackoverflow
Slideshare
Speakerdeck