Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/gold-planes-wear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Invalid changeset format.

The changeset file is missing the required package name and change description. Even for test-only changes with no public API impact, a valid changeset should specify the package and briefly describe the changes.

Apply this diff to fix the changeset format:

 ---
+"@clerk/clerk-js": patch
 ---
+
+Add test cases for OrganizationSwitcher preview visibility in different scenarios (active organization, personal workspace, and no organization selected).
📝 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.

Suggested change
---
---
---
"@clerk/clerk-js": patch
---
Add test cases for OrganizationSwitcher preview visibility in different scenarios (active organization, personal workspace, and no organization selected).
🧰 Tools
🪛 LanguageTool

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

🤖 Prompt for AI Agents
In .changeset/gold-planes-wear.md around lines 1 to 2, the file currently
contains only empty frontmatter and is missing the required changeset YAML
(package name(s), change type, and a short description); update the file to
include a valid changeset frontmatter listing the affected package(s) and change
type (patch/minor/major — use patch for test-only changes) and add a one- or
two-sentence description of the change so the changeset is accepted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,52 @@ describe('OrganizationSwitcher', () => {
});

describe('OrganizationSwitcherTrigger', () => {
it('shows OrganizationPreview when user has an active organization', async () => {
const { wrapper, fixtures } = await createFixtures(f => {
f.withOrganizations();
f.withUser({
email_addresses: ['test@clerk.com'],
organization_memberships: [{ name: 'Test Organization', id: '1', role: 'admin' }],
});
});

// Set the active organization in the context
fixtures.clerk.organization = {
id: '1',
name: 'Test Organization',
slug: 'test-organization',
membersCount: 1,
pendingInvitationsCount: 0,
adminDeleteEnabled: true,
maxAllowedMemberships: 100,
} as any;

const { getByText } = render(<OrganizationSwitcher />, { wrapper });
expect(getByText('Test Organization')).toBeInTheDocument();
});

it('shows PersonalWorkspacePreview when user has no active organization and hidePersonal is false', async () => {
const { wrapper, props } = await createFixtures(f => {
f.withOrganizations();
f.withUser({ email_addresses: ['test@clerk.com'] });
});

props.setProps({ hidePersonal: false });
const { getByText } = render(<OrganizationSwitcher />, { wrapper });
expect(getByText('Personal account')).toBeInTheDocument();
});

it('shows "No organization selected" when user has no active organization and hidePersonal is true', async () => {
const { wrapper, props } = await createFixtures(f => {
f.withOrganizations();
f.withUser({ email_addresses: ['test@clerk.com'] });
});

props.setProps({ hidePersonal: true });
const { getByText } = render(<OrganizationSwitcher />, { wrapper });
expect(getByText('No organization selected')).toBeInTheDocument();
});

it('shows the counter for pending suggestions and invitations', async () => {
const { wrapper, fixtures } = await createFixtures(f => {
f.withOrganizations();
Expand Down