Skip to content

test(mosaic): cover the user button with feature tests in place of per-layer tests - #9943

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-user-button-feature-tests
Sep 29, 2026
Merged

alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-user-button-feature-tests

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Description

Follows #9942. Moves UserButton coverage onto the feature tier and deletes the per-layer tests it replaces.

Deleted (1,990 lines): user-button.model.test.tsx and user-button.view.test.tsx. user-button.layout.test.ts stays: it is a table over a pure function.

user-button.feature.test.tsx now covers each mode's surface, workspace ordering and offers, the foot and menuItemOrder, in-flight states, the trigger, account naming fallbacks, routing (userProfileUrl, organizationProfileUrl, add account, pending session tasks) and the portal root. Queries go through roles, names and text, not styling classes.

The Mosaic UserButton E2E keeps only what a faked FAPI can't prove: an organization switch that survives a reload, sign-out, add account reaching /sign-in, a custom link navigating, and a custom page in the real UserProfile modal. The signed-out render, the custom action, and account switching are left to the feature test.

Not carried over, because nothing in the rendered UserButton can reach it:

  • the plan badge (planLabel is never set by the model)
  • telling a failed refresh apart from a failed accept (there is no error surface yet)
  • styling details (gutter, avatar size, rounding)

The fake FAPI also changes:

  • Accepting an invitation adds the membership.

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 Sep 25, 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 Sep 29, 2026 2:44pm UTC
swingset Ready Ready Preview Sep 29, 2026 2:44pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 83fb51b

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 Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Team

Run ID: 6e14a305-b446-4021-aab3-81e539aa9418

📥 Commits

Reviewing files that changed from the base of the PR and between 4f71b78 and 612d738.

📒 Files selected for processing (7)
  • .changeset/mosaic-user-button-feature-tests.md
  • integration/templates/next-app-router-mosaic/src/app/custom/page.tsx
  • integration/tests/mosaic/user-button.test.ts
  • packages/mosaic/src/__tests__/feature/fake-fapi.ts
  • packages/mosaic/src/features/user-button/__tests__/user-button.feature.test.tsx
  • packages/mosaic/src/features/user-button/__tests__/user-button.model.test.tsx
  • packages/mosaic/src/features/user-button/__tests__/user-button.view.test.tsx
🔗 Linked repositories identified

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

💤 Files with no reviewable changes (2)
  • packages/mosaic/src/features/user-button/tests/user-button.model.test.tsx
  • packages/mosaic/src/features/user-button/tests/user-button.view.test.tsx

Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.


📝 Walkthrough

Walkthrough

The changes add broad UserButton feature-test coverage for modes, menu content, actions, loading states, accessibility, and URL handoffs. They remove the separate model and view test files. Fake FAPI now adds a membership after invitation acceptance. Integration tests and the example page are updated.

Priority: ⬇️ Low

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

Suggested reviewers: ephem

Merge Risk: ⚪ Minimal · up to 612d7

The popup-state tests detect the claimed regression. No actionable merge-blocking issue remains after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: replacing per-layer UserButton tests with feature tests.
Description check ✅ Passed The description directly explains the test migration, deleted tests, retained E2E coverage, new feature coverage, and fake FAPI update.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

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

@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-feature-testing branch from 8589444 to f9a8c57 Compare September 25, 2026 19:22
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from 18d7d82 to f531599 Compare September 25, 2026 19:22
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from f531599 to c2c30ca Compare September 25, 2026 19:26
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from c2c30ca to f1ea25f Compare September 25, 2026 19:44
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from f1ea25f to 25dfd54 Compare September 28, 2026 17:23
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-feature-testing branch from e40a110 to 73ee31d Compare September 28, 2026 17:24
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from 25dfd54 to 8c291fe Compare September 28, 2026 17:24
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-feature-testing branch from 73ee31d to 71824eb Compare September 28, 2026 17:54
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from 8c291fe to 5a1f42b Compare September 28, 2026 17:59
@alexcarpenter
alexcarpenter force-pushed the carp/mosaic-user-button-feature-tests branch from 5a1f42b to 27ec7b0 Compare September 28, 2026 18:14
Base automatically changed from carp/mosaic-feature-testing to main September 29, 2026 14:31
@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/mosaic

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 612d738

@alexcarpenter
alexcarpenter merged commit f98988b into main Sep 29, 2026
51 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-user-button-feature-tests branch September 29, 2026 14:54

This branch was successfully deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants