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 (resolve,reject) {setTimeout(function () {resolve('abc');}, 1);});return expect(promiseThatWillBeFulfilledWithAValue,'to be fulfilled with','abc');
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'abcdef