title: Mocha test will not resolve promise using Sinon stub
body: <p>I'm using Mocha to test a method that has an asynchronous method inside of it. I'm stubbing that dependency with Sinon, and returning a resolved promise. But the promise is never resolved, or at least when the assertion is run it hasn't resolved yet.</p>
  
  <p>Here is the method under test</p>
  
  <pre class="lang-js prettyprint-override"><code>function identify(traits) {
    //THIS GETS CALLED SUCCESSFULLY
    userService.get().then(function(user){
      //CODE NEVER REACHES HERE
  
      userService.set(user).then(function(){
        //do something
      }, function(){
        //handle error
      });
    });
  }
  </code></pre>
  
  <p>And here is the test</p>
  
  <pre class="lang-js prettyprint-override"><code>it('should identify a valid email address', function(){
    var user =  { email: 'test@example.com' };
    var getUserStub = sinon.stub(userService, "get");
    var setUserStub = sinon.stub(userService, "set");
    var userReturn = { email: 'test@example.com', urls: ['http://some.url.com'] };
  
    getUserStub.returns(Promise.resolve(userReturn));
  
    //THE METHOD UNDER TEST
    identifyController.identify(user);
  
    sinon.assert.calledOnce(userService.get);  //WORKS FINE
    sinon.assert.calledOnce(userService.set);  //FAILS
    getUserStub.restore();
  });
  </code></pre>
  
  <p>The assertion on userService.set fails, it says it was called 0 times. What am I doing wrong?</p>