Created
July 2, 2024 23:07
-
-
Save levchenkod/2c6b02aa9ea39e407529a51455080af9 to your computer and use it in GitHub Desktop.
Mock next/router with next-router-mock lib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mockRouter from "next-router-mock"; | |
jest.mock("next/router", () => jest.requireActual("next-router-mock")); | |
describe("Page useRouter hook", () => { | |
it("renders", () => { | |
mockRouter.push("/home?with=query"); | |
//... | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment