Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
fix: Resolve UnhandledPromiseRejection in test (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarlow12 authored Aug 22, 2019
1 parent 60ebb41 commit add4680
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 9 additions & 1 deletion src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {};
console.log = console.group = function() {};
const electronMock = {
ipcRenderer: {
send: jest.fn(),
on: jest.fn(),
},
};

window.require = jest.fn(() => electronMock);

0 comments on commit add4680

Please sign in to comment.