Utilities

Utilities

Sinon.JS has a few utilities used internally in lib/sinon.js. Unless the method in question is documented here, it should not be considered part of the public API, and thus is subject to change.

Utils API

sinon.restore(object);

Restores all fake methods of supplied object

    sinon.stub(obj);

    // run tests...

    sinon.restore(obj);

sinon.restore(method);

Restores supplied method

    sinon.restore(obj.someMethod);

sinon.createStubInstance(constructor);

Creates a new object with the given function as the protoype and stubs all implemented functions.

    class Container {
        contains(item) { /* ... */ }
    }