title: Stubbing and/or mocking a class in sinon.js?
body: <p>I've created a database wrapper for my application, shown below. To test it, I obviously would like to replace the actual database library. I could create a new class that mocks the <code>query</code> method and catch all input there, but using <code>sinon.js</code> seems more appropriate, but how would I use it?<br>
  Is the <code>mock</code> or <code>stub</code> features of <code>sinon.js</code> what I should be using?</p>
  
  <pre><code>wrapper = (function() {
  
    function wrapper() {}
  
    wrapper.db = require("database");
  
    wrapper.prototype.insertUser = function(doc) {
      return this.db.query("INSERT INTO USERS...");
    };
  
    return wrapper;
  
  })();
  </code></pre>