Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/utils/comms.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
updateTrayIcon,
reOpenWindow,
openExternalLink,
setAutoLaunch,
restoreSetting,
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/utils/comms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 2 additions & 3 deletions src/utils/notifications.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as _ from 'lodash';
import { ipcRenderer } from 'electron';

import { generateGitHubWebUrl, getCommentId } from './helpers';
import {
Expand Down Expand Up @@ -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', () => {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/notifications.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -86,7 +87,7 @@ export const raiseNativeNotification = (
remote.getCurrentWindow().hide();
openInBrowser(notifications[0], accounts);
} else {
reOpenWindow();
ipcRenderer.send('reopen-window');
}
};

Expand Down