From f3c4dcd074294ac6ff008912ffba8b1961540e0f Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 2 Jul 2021 14:27:12 -0700 Subject: [PATCH] feat(test): try calling .dispose() x2 in emitter --- test/unit/emitter.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/unit/emitter.test.ts b/test/unit/emitter.test.ts index ebc6491b..c9d24d57 100644 --- a/test/unit/emitter.test.ts +++ b/test/unit/emitter.test.ts @@ -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() })