Skip to content

Commit

Permalink
fix: useUpdateEffect cleanup test returns false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
adesurirey committed Jan 7, 2020
1 parent c893fe3 commit 9b31c42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/useUpdateEffect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ it('should run effect on update', () => {

it('should run cleanup on unmount', () => {
const cleanup = jest.fn();
const hook = renderHook(() => useUpdateEffect(cleanup));
const effect = jest.fn().mockReturnValue(cleanup);
const hook = renderHook(() => useUpdateEffect(effect));

hook.rerender();
hook.unmount();
Expand Down

0 comments on commit 9b31c42

Please sign in to comment.