W3C
school
文档首页
HTML
CSS
Javascript
Python
jQuery
NodeJS
PHP
Java
MySQL
Express
More »
开关
Sinon.js 1 官方文档
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.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()
Fake XHR and server
autoRespond
autoRespondAfter()
Fake XHR and server
fakeHTTPMethods
FakeXMLHttpRequest.addFilter()
FakeXMLHttpRequest.useFilters
request.async
request.autoRespond
request.autoRespondAfter
request.getAllResponseHeaders()
request.getResponseHeader()
request.method
request.password
request.requestBody
request.requestHeaders
request.respond()
request.responseXML
request.setResponseBody()
request.setResponseHeaders()
request.status
request.statusText
request.url
request.username
respondImmediately
server.autoRespond
server.autoRespondAfter
server.configure()
server.fakeHTTPMethods
server.getHTTPMethod()
server.respond()
server.respondImmediately
server.respondWith()
server.restore()
sinon.fakeServer.create()
sinon.fakeServerWithClock.create()
xhr.onCreate
xhr.restore()
Fake timers
clock.restore()
clock.tick()
Fake timers
sinon.useFakeTimers()
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()
JSON-P
JSON-P
Matchers
Matchers
sinon.match()
sinon.match.any
sinon.match.array
sinon.match.bool
sinon.match.date
sinon.match.defined
sinon.match.falsy
sinon.match.func
sinon.match.has()
sinon.match.hasOwn()
sinon.match.instanceOf()
sinon.match.number
sinon.match.object
sinon.match.regexp
sinon.match.same()
sinon.match.string
sinon.match.truthy
sinon.match.typeOf()
Sandboxes
sandbox.mock()
sandbox.reset()
sandbox.restore()
sandbox.spy()
sandbox.stub()
sandbox.useFakeServer()
sandbox.useFakeTimers()
sandbox.useFakeXMLHttpRequest()
sandbox.verify()
sandbox.verifyAndRestore()
Sandboxes
sinon.sandbox.create()
sinon.test()
sinon.testCase()
Utilities
sinon.createStubInstance()
sinon.format()
sinon.log()
sinon.restore()
Utilities
Stubs
sinon.stub()
stub.callArg()
stub.callArgWith()
stub.callsArg()
stub.callsArgAsync()
stub.callsArgOn()
stub.callsArgOnAsync()
stub.callsArgOnWith()
stub.callsArgOnWithAsync()
stub.callsArgWith()
stub.callsArgWithAsync()
stub.onCall()
stub.onFirstCall()
stub.onSecondCall()
stub.onThirdCall()
stub.reset()
stub.resetBehavior()
stub.returns()
stub.returnsArg()
stub.returnsThis()
stub.throws()
stub.withArgs()
stub.yield()
stub.yields()
stub.yieldsAsync()
stub.yieldsOn()
stub.yieldsOnAsync()
stub.yieldsTo()
stub.yieldsToAsync()
stub.yieldsToOn()
stub.yieldsToOnAsync()
stub.yieldTo()
Stubs
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.calledOn()
spy.calledOnce
spy.calledThrice
spy.calledTwice
spy.calledWith()
spy.calledWithExactly()
spy.calledWithMatch()
spy.calledWithNew()
spy.exceptions
spy.firstCall
spy.getCall()
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()
Index
index