Merge pull request #3713 from cdr/jsjoeio-test-emitter
feat(test): try calling .dispose() x2 in emitter
This commit is contained in:
commit
b365830388
@ -41,7 +41,7 @@ describe("emitter", () => {
|
|||||||
|
|
||||||
// Register the onHelloWorld listener
|
// Register the onHelloWorld listener
|
||||||
// and the onGoodbyeWorld
|
// and the onGoodbyeWorld
|
||||||
emitter.event(onHelloWorld)
|
const _onHelloWorld = emitter.event(onHelloWorld)
|
||||||
emitter.event(onGoodbyeWorld)
|
emitter.event(onGoodbyeWorld)
|
||||||
|
|
||||||
await emitter.emit({ event: HELLO_WORLD, callback: mockCallback })
|
await emitter.emit({ event: HELLO_WORLD, callback: mockCallback })
|
||||||
@ -56,6 +56,12 @@ describe("emitter", () => {
|
|||||||
expect(mockSecondCallback).toHaveBeenCalled()
|
expect(mockSecondCallback).toHaveBeenCalled()
|
||||||
expect(mockSecondCallback).toHaveBeenCalledTimes(1)
|
expect(mockSecondCallback).toHaveBeenCalledTimes(1)
|
||||||
|
|
||||||
|
// Dispose of individual listener
|
||||||
|
_onHelloWorld.dispose()
|
||||||
|
|
||||||
|
// Try disposing twice
|
||||||
|
_onHelloWorld.dispose()
|
||||||
|
|
||||||
// Dispose of all the listeners
|
// Dispose of all the listeners
|
||||||
emitter.dispose()
|
emitter.dispose()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user