diff --git a/src/__tests__/cleanup.js b/src/__tests__/cleanup.js index d1332bf4..f3f6a557 100644 --- a/src/__tests__/cleanup.js +++ b/src/__tests__/cleanup.js @@ -26,3 +26,17 @@ test('cleanup does not error when an element is not a child', async () => { render(
, {container: document.createElement('div')}) await cleanup() }) + +test('cleanup waits for queued microtasks during unmount sequence', async () => { + const spy = jest.fn() + + const Test = () => { + React.useEffect(() => () => setImmediate(spy)) + + return null + } + + render(