diff --git a/src/__tests__/render.js b/src/__tests__/render.js index 54916ba4..4e78afa6 100644 --- a/src/__tests__/render.js +++ b/src/__tests__/render.js @@ -87,3 +87,17 @@ test('renders options.wrapper around node', () => { `) }) + +test('flushes useEffect cleanup functions sync on unmount()', () => { + const spy = jest.fn() + function Component() { + React.useEffect(() => spy, []) + return null + } + const {unmount} = render() + expect(spy).toHaveBeenCalledTimes(0) + + unmount() + + expect(spy).toHaveBeenCalledTimes(1) +})