a utility for testing promise code
A testing library for then-able promises.
See the example;
Node.js or Component
var PromiseTesting = ;var engine = ;
In the browser (included via script tag)
var engine = ;
If you are using any chai extensions (i.e. SinonChai) before calling the scanChai method.
Promises need to be wrapped by a wrapper object for testing.
var rawPromise = someService;var wrappedPromise = engine;
Functions that always return promises can be
patched for convenience
engine;//all calls to the patched function now return a wrappedPromisevar wrappedPromise1 = someService;var wrappedPromise2 = someService;
You can now use chai expectations just like you normally would, however they won't be run until the promise completes.
is equivalent to