promise allows to create fake promises that expose their internal state and can be resolved or rejected on demand.
var promise = sinon.promise();
var executor = sinon.fake(); var promise = sinon.promise(executor);
var promise = sinon.promise(function (resolve, reject) {
// ...
});
promise.statusThe internal status of the promise. One of pending, resolved, rejected.
promise.resolvedValueThe promise resolved value.
promise.rejectedValueThe promise rejected value.
promise.resolve(value)Resolves the promise with the given value. Throws if the promise is not pending.
promise.reject(value)Rejects the promise with the given value. Throws if the promise is not pending.
© 2010–2022 Christian Johansen
Licensed under the BSD License.
https://sinonjs.org/releases/v15/promises