mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
mock electron log in all tests
This commit is contained in:
parent
1a77cb0e90
commit
42edc38413
@ -18,6 +18,8 @@ const getMainWindow = {
|
|||||||
setFullScreenable: jest.fn(),
|
setFullScreenable: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jest.mock('electron-log');
|
||||||
|
|
||||||
jest.mock('../src/common/env', () => {
|
jest.mock('../src/common/env', () => {
|
||||||
return {
|
return {
|
||||||
isWindowsOS: true,
|
isWindowsOS: true,
|
||||||
@ -52,12 +54,26 @@ jest.mock('../src/app/window-actions', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jest.mock('../src/common/logger', () => {
|
||||||
|
return {
|
||||||
|
logger: {
|
||||||
|
setLoggerWindow: jest.fn(),
|
||||||
|
error: jest.fn(),
|
||||||
|
warn: jest.fn(),
|
||||||
|
info: jest.fn(),
|
||||||
|
verbose: jest.fn(),
|
||||||
|
debug: jest.fn(),
|
||||||
|
silly: jest.fn(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
describe('child window handle', () => {
|
describe('child window handle', () => {
|
||||||
const frameName = { };
|
const frameName = {};
|
||||||
const disposition = 'new-window';
|
const disposition = 'new-window';
|
||||||
const newWinOptions = {
|
const newWinOptions = {
|
||||||
webPreferences: jest.fn(),
|
webPreferences: jest.fn(),
|
||||||
webContents: { ...ipcRenderer, ...getMainWindow, webContents: ipcRenderer},
|
webContents: { ...ipcRenderer, ...getMainWindow, webContents: ipcRenderer },
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should call `did-start-loading` correctly on WindowOS', () => {
|
it('should call `did-start-loading` correctly on WindowOS', () => {
|
||||||
@ -82,7 +98,7 @@ describe('child window handle', () => {
|
|||||||
handleChildWindow(ipcRenderer as any);
|
handleChildWindow(ipcRenderer as any);
|
||||||
ipcRenderer.send('new-window', ...args);
|
ipcRenderer.send('new-window', ...args);
|
||||||
ipcRenderer.send('did-finish-load');
|
ipcRenderer.send('did-finish-load');
|
||||||
expect(spy).lastCalledWith('page-load', {
|
expect(spy).lastCalledWith('page-load', {
|
||||||
enableCustomTitleBar: false,
|
enableCustomTitleBar: false,
|
||||||
isMainWindow: false,
|
isMainWindow: false,
|
||||||
isWindowsOS: true,
|
isWindowsOS: true,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
jest.mock('electron-log');
|
||||||
|
|
||||||
jest.mock('../src/app/window-actions', () => {
|
jest.mock('../src/app/window-actions', () => {
|
||||||
return {
|
return {
|
||||||
activate: jest.fn(),
|
activate: jest.fn(),
|
||||||
@ -18,6 +20,20 @@ jest.mock('../src/common/env', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jest.mock('../src/common/logger', () => {
|
||||||
|
return {
|
||||||
|
logger: {
|
||||||
|
setLoggerWindow: jest.fn(),
|
||||||
|
error: jest.fn(),
|
||||||
|
warn: jest.fn(),
|
||||||
|
info: jest.fn(),
|
||||||
|
verbose: jest.fn(),
|
||||||
|
debug: jest.fn(),
|
||||||
|
silly: jest.fn(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
describe('protocol handler', () => {
|
describe('protocol handler', () => {
|
||||||
let protocolHandlerInstance;
|
let protocolHandlerInstance;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user