[MM-51871] Migrate mainWindow and settingsWindow to singletons (#2650)

* Migrate mainWindow to singleton

* Migrate settingsWindow to singleton

* PR feedback

* Missed a couple unwrapping cases
This commit is contained in:
Devin Binnie
2023-04-04 10:01:40 -04:00
committed by GitHub
parent c682cf5dd2
commit 22ec280945
46 changed files with 1131 additions and 990 deletions

View File

@@ -3,6 +3,7 @@
'use strict';
import {AuthManager} from 'main/authManager';
import MainWindow from 'main/windows/mainWindow';
import WindowManager from 'main/windows/windowManager';
import ModalManager from 'main/views/modalManager';
@@ -84,8 +85,11 @@ jest.mock('main/trustedOrigins', () => ({
save: jest.fn(),
}));
jest.mock('main/windows/mainWindow', () => ({
get: jest.fn().mockImplementation(() => ({})),
}));
jest.mock('main/windows/windowManager', () => ({
getMainWindow: jest.fn().mockImplementation(() => ({})),
getServerURLFromWebContentsId: jest.fn(),
}));
@@ -151,7 +155,7 @@ describe('main/authManager', () => {
const authManager = new AuthManager();
it('should not pop modal when no main window exists', () => {
WindowManager.getMainWindow.mockImplementationOnce(() => null);
MainWindow.get.mockImplementationOnce(() => null);
authManager.popLoginModal({url: 'http://anormalurl.com'}, {
isProxy: false,
host: 'anormalurl',
@@ -219,7 +223,7 @@ describe('main/authManager', () => {
const authManager = new AuthManager();
it('should not pop modal when no main window exists', () => {
WindowManager.getMainWindow.mockImplementationOnce(() => null);
MainWindow.get.mockImplementationOnce(() => null);
authManager.popPermissionModal({url: 'http://anormalurl.com'}, {
isProxy: false,
host: 'anormalurl',