title: Testing rejected promise in Mocha/Chai
body: <p>I have a class that rejects a promise:</p>
  
  <pre><code>Sync.prototype.doCall = function(verb, method, data) {
    var self = this;
  
    self.client = P.promisifyAll(new Client());
  
    var res = this.queue.then(function() {
      return self.client.callAsync(verb, method, data)
        .then(function(res) {
          return;
        })
        .catch(function(err) {    
          // This is what gets called in my test    
          return P.reject('Boo');
        });
    });
  
    this.queue = res.delay(this.options.throttle * 1000);
    return res;
  };
  
  Sync.prototype.sendNote = function(data) {
    var self = this;
    return self.doCall('POST', '/Invoice', {
      Invoice: data
    }).then(function(res) {
      return data;
    });
  };
  </code></pre>
  
  <p>In my test:</p>
  
  <pre><code>return expect(s.sendNote(data)).to.eventually.be.rejectedWith('Boo');
  </code></pre>
  
  <p>However while the test passes it throws the error to the console.</p>
  
  <p>Unhandled rejection Error: Boo
     ...</p>
  
  <p>With non promise errors I have used bind to test to prevent the error from being thrown until Chai could wrap and test:</p>
  
  <pre><code>return expect(s.sendNote.bind(s, data)).to.eventually.be.rejectedWith('Boo');
  </code></pre>
  
  <p>However this does not work with this and returns:</p>
  
  <p>TypeError: <code>[Function] is not a thenable.</code></p>
  
  <p>What is the correct way to test for this?</p>