What is the use of sinon.js?


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: 27-Nov-2019

401 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements