From 9b31c42ccb42fe13fc24f7434b00a1bcbee8cd8a Mon Sep 17 00:00:00 2001 From: Arnaud de Surirey Date: Tue, 7 Jan 2020 19:34:57 +0100 Subject: [PATCH] fix: useUpdateEffect cleanup test returns false positive --- tests/useUpdateEffect.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/useUpdateEffect.test.ts b/tests/useUpdateEffect.test.ts index 5d00265bab..02c81461de 100644 --- a/tests/useUpdateEffect.test.ts +++ b/tests/useUpdateEffect.test.ts @@ -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();