initial
This commit is contained in:
20
test/test.ts
Normal file
20
test/test.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { expect, tap } from 'tapbundle'
|
||||
|
||||
import * as smartevent from '../dist/index'
|
||||
|
||||
let myEventEmitter: smartevent.EventEmitter
|
||||
|
||||
tap.test('should create an emitter ->', async () => {
|
||||
myEventEmitter = new smartevent.EventEmitter()
|
||||
expect(myEventEmitter).to.be.instanceof(smartevent.EventEmitter)
|
||||
})
|
||||
|
||||
tap.test('smartevent.once -> should return a promise', async () => {
|
||||
let 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
|
||||
})
|
||||
|
||||
tap.start()
|
Reference in New Issue
Block a user