[PM-6426] Adding jest tests to the ForegroundTaskSchedulerService and the BackgroundTaskSchedulerService
This commit is contained in:
parent
8d45abbced
commit
b89005feb3
|
@ -68,6 +68,8 @@ describe("BackgroundTaskSchedulerService", () => {
|
|||
|
||||
triggerPortOnDisconnectEvent(portMock);
|
||||
expect(backgroundTaskSchedulerService["ports"].size).toBe(0);
|
||||
expect(portMock.onMessage.removeListener).toHaveBeenCalled();
|
||||
expect(portMock.onDisconnect.removeListener).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ export class BackgroundTaskSchedulerService extends BrowserTaskSchedulerServiceI
|
|||
*/
|
||||
private handlePortOnDisconnect = (port: chrome.runtime.Port) => {
|
||||
port.onMessage.removeListener(this.handlePortMessage);
|
||||
port.onDisconnect.removeListener(this.handlePortOnDisconnect);
|
||||
this.ports.delete(port);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue