Skip to content

Commit f61bd37

Browse files
committed
fix subtitle
1 parent 0a42af0 commit f61bd37

2 files changed

Lines changed: 38 additions & 5 deletions

File tree

apps/sim/app/workspace/[workspaceId]/settings/components/billing/billing.test.tsx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,25 @@ describe('Billing payer scope', () => {
319319
)
320320
})
321321

322+
it('does not show a governing subscription description for a free personal workspace', async () => {
323+
mockPersonalQuery.current = {
324+
data: {
325+
success: true,
326+
context: 'user',
327+
data: { ...PERSONAL_DATA, plan: 'free', status: 'active' },
328+
},
329+
isLoading: false,
330+
refetch: vi.fn(),
331+
}
332+
333+
await act(async () => {
334+
root.render(<Billing scope='account' governingWorkspaceName='Free workspace' />)
335+
})
336+
337+
expect(container.textContent).toContain('Personal Free plan')
338+
expect(container.querySelector('main > p')).toBeNull()
339+
})
340+
322341
it('renders an explicit free organization state without subscription controls', async () => {
323342
mockOrganizationQuery.current = {
324343
data: organizationResponse({
@@ -336,7 +355,13 @@ describe('Billing payer scope', () => {
336355
}
337356

338357
await act(async () => {
339-
root.render(<Billing scope='organization' organizationId='org-target' />)
358+
root.render(
359+
<Billing
360+
scope='organization'
361+
organizationId='org-target'
362+
governingWorkspaceName='Free organization workspace'
363+
/>
364+
)
340365
})
341366

342367
expect(container.textContent).toContain('Organization Free plan')
@@ -360,12 +385,19 @@ describe('Billing payer scope', () => {
360385
}
361386

362387
await act(async () => {
363-
root.render(<Billing scope='organization' organizationId='org-target' />)
388+
root.render(
389+
<Billing
390+
scope='organization'
391+
organizationId='org-target'
392+
governingWorkspaceName='Lapsed organization workspace'
393+
/>
394+
)
364395
})
365396

366397
expect(container.textContent).toContain('Organization Max for Teams plan ended')
367398
expect(container.textContent).toContain('Choose a new plan for this organization')
368399
expect(container.textContent).not.toContain('Cancel subscription')
400+
expect(container.querySelector('main > p')).toBeNull()
369401
expect(
370402
container.querySelector('a[href="/workspace/organization-workspace/upgrade"]')?.textContent
371403
).toBe('Explore organization plans')

apps/sim/app/workspace/[workspaceId]/settings/components/billing/billing.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,10 @@ export function Billing({
456456
const subscriptionOwner = isOrganizationScope
457457
? `${organizationBilling?.organizationName ?? 'The organization'}’s subscription`
458458
: 'Your personal subscription'
459-
const settingsDescription = governingWorkspaceName
460-
? `${subscriptionOwner} governs ${governingWorkspaceName}.`
461-
: undefined
459+
const settingsDescription =
460+
governingWorkspaceName && subscription.isPaid
461+
? `${subscriptionOwner} governs ${governingWorkspaceName}.`
462+
: undefined
462463

463464
return (
464465
<SettingsPanel description={settingsDescription}>

0 commit comments

Comments
 (0)