In this article we analyze differences of the restore, reset, resetHistory and resetBehaviour functions in sinon, and how they behave depending on whether our sinon fakes are anonymous or they wrap existing properties. — A very common approach while working with sinon, as shown in their own documentation, is to call the function restore as part of Mocha’s afterEach hook. afterEach(function () {
// completely restore all fakes created through the sandbox
sandbox.restore();
});