generated at
2/16/2025, 5:58:47 PM
Next.jsのテスト
https://zenn.dev/takepepe/articles/testing-with-nextjs
https://nextjs.org/docs/testing
useRouterをmockする
Jestのmock
を使っている
ts
jest.mock('next/router', () => ({ useRouter() { return { asPath: '/', }; }, }));
すごい
どういう仕組なんだこれ
https://fwywd.com/tech/next-testing-mock
https://blog.shibayu36.org/entry/2019/12/04/193000
https://blog.shinki.net/posts/jest-next-router-mock