title: Assert arguments of stubbed methods with sinon
body: <pre><code>import ManagerDaoStub from '../salesforce/__test__/ManagerDaoStub';
  import criticalMerchants from '../criticalMerchants';
  describe('criticalMerchants Unit Tests', () =&gt; {
      before(() =&gt; {
          ManagerDaoStub.initStubs();    
      });
      after(() =&gt; {
          ManagerDaoStub.restoreStubs();
      });
      it('assert the arguments of stubbed method', (done)=&gt;{
          let load = criticalMerchants.createCases(MERCHANT, DEVICE_ID, KEY, {});
          return done();
      });
  })
  </code></pre>
  
  <p>This is the test file written in node <code>criticalMerchants.test.js</code>. The method i want to test which is <code>createCases</code> uses a method in <code>ManagerDao</code>, which has been stubbed in <code>ManagerDaoStub</code> as below.</p>
  
  <pre><code>import ManagerDao from '../ManagerDao';
  class ManagerDaoStub {
  
      constructor() {
         this.sandbox = sinon.sandbox.create();
          }
      initStubs(sandbox) {
          this.sandbox = sandbox || this.sandbox;
          this.restoreStubs();
          this.initFindOpenCases();   
      }
      restoreStubs() {
          this.sandbox.restore();
      }
      initFindOpenCases() {
          let findOpenCases = this.sandbox.stub(ManagerDao, "findOpenCases");
          findOpenCases
              .withArgs(DEVICE_ID, KEY, match.func)
              .callsArgWith(2, new Error("Test error"));
     }
  }
  </code></pre>
  
  <p>I want to assert whether this stubbed method <code>initFindOpenCases</code> was called with the right arguments (DEVICE_ID,KEY,null). I used 
  <code>sinon.assert.calledWith(ManagerDaoStub.initFindOpenCases, DEVICE_ID, KEY, null)</code> and this gives the following error:</p>
  
  <blockquote>
    <p>AssertError: initFindOpenCases() is not stubbed.</p>
  </blockquote>
  
  <p>Can someone suggest a proper way to do this?</p>