diff --git a/src/App.test.tsx b/src/App.test.tsx index f7477d809a..6b7fb3361a 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -12,6 +12,16 @@ import { ErrorHandler } from "./react/components/common/errorHandler/errorHandle describe("App Component", () => { const defaultState: IApplicationState = initialState; const store = createReduxStore(defaultState); + const electronMock = { + ipcRenderer: { + send: jest.fn(), + on: jest.fn(), + }, + }; + + beforeAll(() => { + delete (window as any).require; + }); function createComponent() { return mount( diff --git a/src/setupTests.js b/src/setupTests.js index 91fa470e90..1187adf90b 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -4,4 +4,12 @@ import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); // Silence console.log and console.group statements in testing -console.log = console.group = function() {}; \ No newline at end of file +console.log = console.group = function() {}; +const electronMock = { + ipcRenderer: { + send: jest.fn(), + on: jest.fn(), + }, +}; + +window.require = jest.fn(() => electronMock);