fix(core): update

This commit is contained in:
2018-12-10 23:41:41 +01:00
parent e98fe56488
commit 4b22e8118b
6 changed files with 232 additions and 31 deletions

View File

@ -9,12 +9,12 @@ tap.test('should create an emitter ->', async () => {
expect(myEventEmitter).to.be.instanceof(smartevent.EventEmitter);
});
tap.test('smartevent.once -> should return a promise', async () => {
let oncePromise = smartevent.once(myEventEmitter, 'customEvent');
tap.test('smartevent.once -> should return a promise', async (tools) => {
const oncePromise = smartevent.once(myEventEmitter, 'customEvent');
expect(oncePromise).to.be.instanceof(Promise);
expect(oncePromise).to.not.be.fulfilled;
myEventEmitter.emit('customEvent');
await expect(oncePromise).to.eventually.be.fulfilled;
expect(oncePromise).to.not.be.rejected;
myEventEmitter.emit('customEvent', 'hithere');
await expect(oncePromise).to.eventually.be.fulfilled.with.equal('hithere');
});
tap.start();