Archived
1
0

feat(test): try calling .dispose() x2 in emitter

This commit is contained in:
Joe Previte 2021-07-02 14:27:12 -07:00
parent 58514c422f
commit f3c4dcd074
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -41,7 +41,7 @@ describe("emitter", () => {
// Register the onHelloWorld listener
// and the onGoodbyeWorld
emitter.event(onHelloWorld)
const _onHelloWorld = emitter.event(onHelloWorld)
emitter.event(onGoodbyeWorld)
await emitter.emit({ event: HELLO_WORLD, callback: mockCallback })
@ -56,6 +56,12 @@ describe("emitter", () => {
expect(mockSecondCallback).toHaveBeenCalled()
expect(mockSecondCallback).toHaveBeenCalledTimes(1)
// Dispose of individual listener
_onHelloWorld.dispose()
// Try disposing twice
_onHelloWorld.dispose()
// Dispose of all the listeners
emitter.dispose()
})