Sinon's callsFake() function lets you configure what a stub function returns. Here's what you need to know.
Sinon Tutorials
Here's how mocks work in Sinon.js
Here's how spies work in Sinon.js
Here's how you can use Sinon to stub a function.
Here's two ways to check whether a SinonJS stub was called with given arguments.
Here's how you can use `sinon.stub()` to stub out functions and assert that they were called.