diff --git a/lib/channels/src/index.test.ts b/lib/channels/src/index.test.ts index 3a440fc229e..0f8b8ceceb9 100644 --- a/lib/channels/src/index.test.ts +++ b/lib/channels/src/index.test.ts @@ -51,11 +51,23 @@ describe('Channel', () => { it('should do the same as addListener', () => { const eventName = 'event1'; - channel.addListener(eventName, jest.fn()); + channel.on(eventName, jest.fn()); expect(channel.listeners(eventName).length).toBe(1); }); }); + describe('method:off', () => { + it('should remove listeners', () => { + const eventName = 'event1'; + const fn = jest.fn(); + + channel.on(eventName, fn); + expect(channel.listeners(eventName).length).toBe(1); + channel.off(eventName, fn); + expect(channel.listeners(eventName).length).toBe(0); + }); + }); + describe('method:emit', () => { it('should execute the callback fn of a listener', () => { const eventName = 'event1';