Skip to content

Commit

Permalink
Refactor spy in ErrorHandler test
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunsaker committed Jun 19, 2018
1 parent 625fec8 commit f511ecb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handlers/ErrorHandler/__tests__/ErrorHandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ it('catches errors in componentDidCatch', () => {

const dispatch = jest.fn();

jest.spyOn(ErrorHandler.prototype, 'componentDidCatch');
const spy = jest.spyOn(ErrorHandler.prototype, 'componentDidCatch');

const component = renderer.create(
<ErrorHandler dispatch={dispatch}>
Expand All @@ -48,6 +48,6 @@ it('catches errors in componentDidCatch', () => {

const errorPage = root.findByProps({ testID: 'errorPage' });
expect(errorPage).toBeDefined();
expect(ErrorHandler.prototype.componentDidCatch).toHaveBeenCalled();
expect(spy).toHaveBeenCalled();
expect(dispatch).toMatchSnapshot(); // dispatch function has been called
});

0 comments on commit f511ecb

Please sign in to comment.