Skip to content

test(mosaic): cover switcher model paths that no test caught - #10467

Open
alexcarpenter wants to merge 2 commits into
mainfrom
carp/mosaic-test-audit
Open

alexcarpenter wants to merge 2 commits into
mainfrom
carp/mosaic-test-audit

Conversation

@alexcarpenter

Copy link
Copy Markdown
Member

Description

Adds feature tests for switcher model behavior that no existing test caught. Each new test fails when the matching line in switcher.model.tsx is broken by hand (a hand-run mutation pass over the model).

User button:

  • A failed invitation accept is logged, the popup stays open, and the invitation drops out once it is no longer pending.
  • A failed suggestion join that finds the suggestion already accepted shows it as Requested.
  • Switching accounts lands on the instance's after_switch_session_url.
  • No Invite members action for a member without the manage-memberships permission.
  • The next page of invitations loads when the end of the list scrolls into view.
  • Signed out renders nothing, including the fallback.

Organization switcher:

  • afterSelectPersonalUrl (with :id) and afterSelectOrganizationUrl (as a function) decide where a selection lands.
  • afterLeaveOrganizationUrl, afterCreateOrganizationUrl and skipInvitationScreen are passed through to the profile and create flows.

Removes "drops revoked and expired invitations, which have nothing to accept". useOrganizationList only requests status=pending invitations (packages/shared/src/react/hooks/useOrganizationList.tsx), so that test passed with or without the model's filter.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other: tests

@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Oct 28, 2026 12:27am UTC
swingset Ready Ready Preview Oct 28, 2026 12:27am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: efdfdae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between e59aedb and efdfdae.

Files selected for processing: 1
  • packages/mosaic/src/features/user-button/__tests__/user-button.feature.test.tsx
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Walkthrough

The PR adds Mosaic tests for organization-switcher navigation and action options. It adds user-button tests for rendering, account switching, membership controls, invitation and suggestion states, and invitation pagination. It removes a test for hiding revoked and expired invitations. The changeset file contains an empty frontmatter block.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • clerk/javascript#10454: Changes mock restoration in the same feature test files that contain new tests using spies.

Suggested reviewers: ephem

Merge Risk: Minimal · up to efdfd

The test-only changes introduce no established merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "test(mosaic): cover switcher model paths that no test caught" matches the main change. The PR adds feature tests for organization-switcher and user-button behavior in the mosaic package tha…
Description check Passed The description states that the PR adds feature tests for switcher model behavior that no existing test caught. It lists the user button and organization switcher tests, and it explains the removal of…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "test(mosaic): cover switcher model paths that no test caught" matches the main change. The PR adds feature tests for organization-switcher and user-button behavior in the mosaic package that existing tests did not cover, and it removes one redundant test. The title is specific and follows a conventional commit style. It does not list every detail, which is acceptable.

Full details: Description check

Explanation

The description states that the PR adds feature tests for switcher model behavior that no existing test caught. It lists the user button and organization switcher tests, and it explains the removal of the revoked and expired invitations test. This matches the changeset, so the description is related and specific.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10467

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10467

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10467

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10467

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10467

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10467

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10467

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10467

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10467

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10467

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10467

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10467

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10467

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10467

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10467

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10467

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10467

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10467

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10467

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10467

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10467

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10467

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10467

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10467

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10467

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10467

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10467

commit: efdfdae

This branch was successfully deployed

2 active deployments
Preview – swingset — efdfdae5 Deployed Oct 28, 2026 by vercel[bot]
Preview – clerk-js-sandbox — efdfdae5 Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant