In this Sinon tutorial, Jani Hartikainen demonstrates how to make unit testing non-trival JavaScript code trivial with the help of spies, stubs and mocks.
https://www.sitepoint.com/sinon-tutorial-javascript-testing-mocks-spies-stubs/
* Mark Brown * MarcTowler * Sinon * Spies * Stubs * Mocks * Fake timers * Fake XMLHttpRequest and server * CDN * Sinon’s website * Sinon’s spy documentation * Mocha * Chai * Unit Test Your JavaScript Using Mocha and Chai * Sinon Tutorial: JavaScript Testing with Mocks, Spies & Stubs * @SitePoint * CodePen * Sinon’s assertions * Sinon’s assertion documentation * sinon-chai plugin * Sinon Tutorial: JavaScript Testing with Mocks, Spies & Stubs * @SitePoint * CodePen * Sinon Tutorial: JavaScript Testing with Mocks, Spies & Stubs * @SitePoint * CodePen * my article on Ajax testing with Sinon’s fake XMLHttpRequest * store.js * Sinon Tutorial: JavaScript Testing with Mocks, Spies & Stubs * @SitePoint * CodePen * Sinon’s mock documentation * Sinon in the real-world guide