diff --git a/src/utils/comms.test.ts b/src/utils/comms.test.ts index 95ea32756..8a5c5af83 100644 --- a/src/utils/comms.test.ts +++ b/src/utils/comms.test.ts @@ -1,6 +1,5 @@ import { updateTrayIcon, - reOpenWindow, openExternalLink, setAutoLaunch, restoreSetting, @@ -33,12 +32,6 @@ describe('utils/comms.ts', () => { expect(ipcRenderer.send).toHaveBeenCalledWith('update-icon'); }); - it('should reopen the window', () => { - reOpenWindow(); - expect(ipcRenderer.send).toHaveBeenCalledTimes(1); - expect(ipcRenderer.send).toHaveBeenCalledWith('reopen-window'); - }); - it('should restore a setting', () => { restoreSetting('foo', 'bar'); expect(ipcRenderer.send).toHaveBeenCalledTimes(1); diff --git a/src/utils/comms.ts b/src/utils/comms.ts index 69c03e48b..0f7f4e25a 100644 --- a/src/utils/comms.ts +++ b/src/utils/comms.ts @@ -20,10 +20,6 @@ export function updateTrayIcon(notificationsLength = 0): void { } } -export function reOpenWindow(): void { - ipcRenderer.send('reopen-window'); -} - export function restoreSetting(setting, value): void { ipcRenderer.send(setting, value); } diff --git a/src/utils/notifications.test.ts b/src/utils/notifications.test.ts index c1685b262..8b37984be 100644 --- a/src/utils/notifications.test.ts +++ b/src/utils/notifications.test.ts @@ -1,4 +1,5 @@ import * as _ from 'lodash'; +import { ipcRenderer } from 'electron'; import { generateGitHubWebUrl, getCommentId } from './helpers'; import { @@ -128,15 +129,13 @@ describe('utils/notifications.ts', () => { }); it('should click on a native notification (with more than 1 notification)', () => { - jest.spyOn(comms, 'reOpenWindow'); - const nativeNotification = notificationsHelpers.raiseNativeNotification( mockedGithubNotifications, mockAccounts, ); nativeNotification.onclick(null); - expect(comms.reOpenWindow).toHaveBeenCalledTimes(1); + expect(ipcRenderer.send).toHaveBeenCalledWith('reopen-window'); }); it('should play a sound', () => { diff --git a/src/utils/notifications.ts b/src/utils/notifications.ts index 6af31d95e..40f9e80c1 100644 --- a/src/utils/notifications.ts +++ b/src/utils/notifications.ts @@ -1,7 +1,8 @@ +import { ipcRenderer } from 'electron'; const remote = require('@electron/remote'); import { openInBrowser } from '../utils/helpers'; -import { reOpenWindow, updateTrayIcon } from './comms'; +import { updateTrayIcon } from './comms'; import { Notification } from '../typesGithub'; import { AccountNotifications, SettingsState, AuthState } from '../types'; @@ -86,7 +87,7 @@ export const raiseNativeNotification = ( remote.getCurrentWindow().hide(); openInBrowser(notifications[0], accounts); } else { - reOpenWindow(); + ipcRenderer.send('reopen-window'); } };