Repository navigation
Stabilize Next navigation web test mocks - #8035
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a shared ChangesNavigation mock standardization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR stabilizes the shared Next.js navigation mocks used by web page tests. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "Complete pricing test intl mock" | Re-trigger Greptile |
| describe("app pro welcome page", () => { | ||
| test("keeps client navigation components importable after installing the navigation mock", async () => { | ||
| const navigation = await import("next/navigation"); | ||
| const banner = await import("../app/[locale]/components/pro-welcome-banner"); |
There was a problem hiding this comment.
Cached Component Stub Hides Failure
Another pricing-page suite installs a process-wide mock for pro-welcome-banner that exports a stub function. When that suite loads first, this import resolves to the stub, so the type assertion passes without loading the real component or checking its useSearchParams import against the shared navigation mock.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed in c5913f1. The localized pricing suite now imports and renders the real ProWelcomeBanner with the shared next/navigation mock, instead of installing a process-wide component stub. This keeps the importability regression test tied to the real client component. The focused pair and the full sorted web suite pass.
— Claude Code
Summary
next/navigationmock used by web page testsTesting
bun test tests/app-pro-welcome-page.test.tsx tests/app-pricing-page.test.tsx tests/billing-success-page.test.tsxbun run typecheckbun test $(ls tests/*.test.ts tests/*.test.tsx | sort)(661 passed, 91 skipped)CI failure
Summary by cubic
Centralizes a complete
next/navigationmock for web tests to eliminate order-dependent CI failures and keep client hooks importable across suites. Also completes the pricing test setup by adding anext-intlclient mock and rendering the real Pro welcome banner.web/tests/helpers/next-navigation-mock.tsand switched affected tests to use it.redirect,permanentRedirect,notFound,usePathname,useRouter,useSearchParams,useServerInsertedHTML.app-pro-welcome-page,app-pricing-page,billing-success-page, andpricing-pagetests to use the shared, process-wide mock;pricing-pagenow renders the real Pro welcome banner and uses anext-intlclient mock.Written for commit 1c6cf55. Summary will update on new commits.
Summary by CodeRabbit
next/navigationis mocked across pricing, billing-success, and app-pro welcome page tests using a shared helper.next-intlclient-side mock and updated snapshots by removing theProWelcomeBannerstub.