promise-spy
v1.0.0
Published
Sets up an interceptor for Promise's which so we can get them later statically
Downloads
12
Maintainers
Readme
promise-spy
Sets up an interceptor for Promise's which so we can get them later statically
Installation ... someday
npm install --save-dev promise-spy
Usage
function doSomethingAsyncThatIsInaccessible(cb) {
new Promise(resolve => {
cb();
resolve();
});
}
describe('Some Test', () => {
beforeEach(() => {
PromiseSpy.install();
});
afterEach(() => {
PromiseSpy.uninstall();
});
it('should do something', async () => {
const callback = sinon.stub();
doSomethingAsyncThatIsInaccessible(callback);
await PromiseSpy.wait();
expect(callback.calledOnce).to.equal(true);
});
});