diff --git a/content/docs/testing-recipes.md b/content/docs/testing-recipes.md index 87552259..1fa4a696 100644 --- a/content/docs/testing-recipes.md +++ b/content/docs/testing-recipes.md @@ -465,13 +465,12 @@ import { act } from "react-dom/test-utils"; import Card from "./card"; -jest.useFakeTimers(); - let container = null; beforeEach(() => { // setup a DOM element as a render target container = document.createElement("div"); document.body.appendChild(container); + jest.useFakeTimers(); }); afterEach(() => { @@ -479,6 +478,7 @@ afterEach(() => { unmountComponentAtNode(container); container.remove(); container = null; + jest.useRealTimers(); }); it("should select null after timing out", () => {