to be fulfilled with

  • <Promise> to be fulfilled with <any>

Asserts that a promise is fulfilled with a specific value:

const promiseThatWillBeFulfilledWithAValue = new Promise(function (
) {
  setTimeout(function () {
  }, 1);
return expect(
  'to be fulfilled with',

The expected value will be matched against the value with to satisfy semantics, so you can pass any of the values supported by to satisfy:

return expect(Promise.resolve('abc'), 'to be fulfilled with', /b/);

You get a nice diff if the assertion fails:

return expect(Promise.resolve('abc'), 'to be fulfilled with', 'def');
expected Promise to be fulfilled with 'def'
expected 'abc' to equal 'def'