Setup
Fakes, spies and stubs are created in the default sandbox which needs to be restored after each test to prevent memory leaks. We use a Mocha hook plugin for that:
// Restores the default sandbox after every testexports.mochaHooks = { afterEach() { sinon.restore(); },};Types of test doubles
| Type | What it does | Behavior | Pre-programmed behavior | Pre-programmed expectations | When to use | |