to be fulfilled

  • <Promise> to be fulfilled

Asserts that a promise is fulfilled.

var promiseThatWillBeFulfilled = new Promise(function(resolve, reject) {
  setTimeout(resolve, 1);
});
 
return expect(promiseThatWillBeFulfilled, 'to be fulfilled');

If the promise is rejected, the assertion will fail with the following output:

var rejectedPromise = new Promise(function(resolve, reject) {
  setTimeout(function() {
    reject(new Error('argh'));
  }, 1);
});
 
return expect(rejectedPromise, 'to be fulfilled');
expected Promise to be fulfilled
  
Promise unexpectedly rejected with Error('argh')