Use of Sinon.js in JavaScript Testing



SinonJS provides stand-alone test spies, stubs and mocks. It is a library that we can use to create object mocks for unit testing.

Spies − Fake functions that we can use to track executions.

Stubs −Functions replacements from which we can return whatever we want or have our functions work in a way that suites us to be able to test multiple scenarios.

Mocks −Fake methods

All these objects help in unit testing our code.

Updated on: 2019-11-27T12:21:19+05:30

488 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements