-
Notifications
You must be signed in to change notification settings - Fork 409
test(vue): Add unit test for Vue's Clerk component renderer #7234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: ee4809e The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
WalkthroughAdds a minimal changeset file and a comprehensive unit test suite for the Vue 3 ClerkHostRenderer component covering lifecycle (mount/unmount), open/close flows, prop updates, edge cases, and timing robustness. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (9)
Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (1)
packages/vue/src/components/__tests__/ClerkHostRenderer.test.ts (1)
26-66: Consider consolidating redundant mount tests.Both tests validate the same mounting behavior with different prop shapes. Consider combining them or using
it.eachto reduce duplication.Example refactor:
it.each([ { name: 'appearance props', props: { appearance: { elements: { rootBox: 'test-class' } } }, }, { name: 'component props', props: { transferable: true, withSignUp: true }, }, ])('mounts component with $name', async ({ props }) => { render(ClerkHostRenderer, { props: { mount: mockMount, props }, }); await nextTick(); expect(mockMount).toHaveBeenCalledTimes(1); expect(mockMount).toHaveBeenCalledWith(expect.any(HTMLDivElement), props); });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.changeset/six-files-tap.md(1 hunks)packages/vue/src/components/__tests__/ClerkHostRenderer.test.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Packages
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (5)
packages/vue/src/components/__tests__/ClerkHostRenderer.test.ts (5)
1-12: LGTM!The imports and mock setup are clean and appropriate. The ClerkLoaded mock correctly renders children using slots.
332-348: Good edge case coverage for ref timing.This test correctly verifies that mount only occurs after the ref is set, addressing a potential race condition.
350-373: LGTM!Good test for graceful degradation when optional updateProps is not provided.
390-452: LGTM!These tests properly validate deep prop changes and empty prop objects, ensuring the component handles various prop shapes correctly.
454-471: Good coverage for dual pattern usage.This test ensures both mount and open can coexist, which is valuable for validating flexible component usage.
Description
Adds unit tests for
ClerkHostRenderer, the shared component that handles mounting/unmounting for all Vue UI components. Not every Vue component has integration tests, but we want to ensure that mounting Clerk components in Vue works correctly.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit