test(ui): add stale protect-check route regression#9095
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
📝 WalkthroughWalkthroughUpdated a single test case in SignUpProtectCheck.test.tsx to render the ChangesProtect-check test update
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/components/SignUp/__tests__/SignUpProtectCheck.test.tsx`:
- Around line 78-91: This test is documenting a known broken flow, so it should
be marked as expected-to-fail rather than a normal passing test. Update the
SignUpProtectCheck test case in SignUpProtectCheck.test.tsx from a plain it(...)
to Vitest’s it.fails(...) (or another explicit expected-failure mechanism) so
the suite does not fail in CI while navigateToFlowStart and the protect-check
route behavior remain unfixed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Repository UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 8c1520c8-ff3c-4376-8c6f-b681b9f700c4
📒 Files selected for processing (1)
packages/ui/src/components/SignUp/__tests__/SignUpProtectCheck.test.tsx
| it('routes stale standalone protect-check visits through SignUp routes back to the flow start', async () => { | ||
| const { wrapper, fixtures } = await createFixtures(f => { | ||
| f.startSignUpWithEmailAddress(); | ||
| }); | ||
| fixtures.router.currentPath = '/sign-up/protect-check'; | ||
| fixtures.router.fullPath = '/sign-up'; | ||
| fixtures.router.indexPath = '/sign-up'; | ||
| fixtures.router.matches.mockImplementation((path?: string) => path === 'protect-check'); | ||
|
|
||
| render(<SignUp />, { wrapper }); | ||
|
|
||
| await waitFor(() => expect(fixtures.router.navigate).toHaveBeenCalledWith('/sign-up')); | ||
| expect(mockExecute).not.toHaveBeenCalled(); | ||
| }); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Mark this as an expected-to-fail regression test.
Per the PR objectives, this test is intentionally documenting a currently-broken behavior (navigateToFlowStart no-ops when routed through the real SignUp/Route path="protect-check" because indexPath equals the relative currentPath). As written, this is a plain it(...) block, so it will fail in CI once merged. Use Vitest's it.fails (or skip with a tracking-issue comment) so the suite doesn't break until the underlying fix lands.
🔧 Proposed fix
- it('routes stale standalone protect-check visits through SignUp routes back to the flow start', async () => {
+ // TODO(`#XXXX`): navigateToFlowStart currently no-ops for routed protect-check visits.
+ it.fails('routes stale standalone protect-check visits through SignUp routes back to the flow start', async () => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('routes stale standalone protect-check visits through SignUp routes back to the flow start', async () => { | |
| const { wrapper, fixtures } = await createFixtures(f => { | |
| f.startSignUpWithEmailAddress(); | |
| }); | |
| fixtures.router.currentPath = '/sign-up/protect-check'; | |
| fixtures.router.fullPath = '/sign-up'; | |
| fixtures.router.indexPath = '/sign-up'; | |
| fixtures.router.matches.mockImplementation((path?: string) => path === 'protect-check'); | |
| render(<SignUp />, { wrapper }); | |
| await waitFor(() => expect(fixtures.router.navigate).toHaveBeenCalledWith('/sign-up')); | |
| expect(mockExecute).not.toHaveBeenCalled(); | |
| }); | |
| // TODO(`#XXXX`): navigateToFlowStart currently no-ops for routed protect-check visits. | |
| it.fails('routes stale standalone protect-check visits through SignUp routes back to the flow start', async () => { | |
| const { wrapper, fixtures } = await createFixtures(f => { | |
| f.startSignUpWithEmailAddress(); | |
| }); | |
| fixtures.router.currentPath = '/sign-up/protect-check'; | |
| fixtures.router.fullPath = '/sign-up'; | |
| fixtures.router.indexPath = '/sign-up'; | |
| fixtures.router.matches.mockImplementation((path?: string) => path === 'protect-check'); | |
| render(<SignUp />, { wrapper }); | |
| await waitFor(() => expect(fixtures.router.navigate).toHaveBeenCalledWith('/sign-up')); | |
| expect(mockExecute).not.toHaveBeenCalled(); | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ui/src/components/SignUp/__tests__/SignUpProtectCheck.test.tsx`
around lines 78 - 91, This test is documenting a known broken flow, so it should
be marked as expected-to-fail rather than a normal passing test. Update the
SignUpProtectCheck test case in SignUpProtectCheck.test.tsx from a plain it(...)
to Vitest’s it.fails(...) (or another explicit expected-failure mechanism) so
the suite does not fail in CI while navigateToFlowStart and the protect-check
route behavior remain unfixed.
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Adds a failing route-level regression test for stale standalone SignUp protect-check visits after #9082. The existing stale-route test renders SignUpProtectCheck directly, but the real SignUp route wraps it in Route path="protect-check", where navigateToFlowStart currently no-ops because router.indexPath equals router.currentPath. This PR intentionally contains only the failing test.
Summary by CodeRabbit