Skip to content

Commit d48435f

Browse files
fix(billing): Hide test ent/free/trial plans from Change Plan (#94287)
Closes https://linear.app/getsentry/issue/BIL-809/remove-enterprise-test-plans-from-the-change-plan-list I also hid the test free and trial plans since you can't use the Change Plan action on those without getting a 500.
1 parent 9bd2004 commit d48435f

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

static/gsAdmin/components/changePlanAction.spec.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
screen,
1212
userEvent,
1313
waitFor,
14+
within,
1415
} from 'sentry-test/reactTestingLibrary';
1516
import selectEvent from 'sentry-test/selectEvent';
1617

@@ -60,11 +61,22 @@ describe('ChangePlanAction', () => {
6061
{events: 25000, price: 5000},
6162
],
6263
},
63-
userSelectable: true,
64+
userSelectable: false,
65+
isTestPlan: true,
66+
});
67+
68+
const freeTestPlan = PlanFixture({
69+
id: 'free_test_monthly',
70+
name: 'TEST Tier Free Test Plan',
71+
price: 0,
72+
basePrice: 0,
73+
billingInterval: 'monthly',
74+
userSelectable: false,
6475
isTestPlan: true,
6576
});
6677

6778
BILLING_CONFIG.planList.push(testPlan);
79+
BILLING_CONFIG.planList.push(freeTestPlan);
6880

6981
beforeEach(() => {
7082
jest.clearAllMocks();
@@ -308,10 +320,15 @@ describe('ChangePlanAction', () => {
308320
const testTierTab = screen.getByRole('tab', {name: 'TEST'});
309321
await userEvent.click(testTierTab);
310322

311-
// Verify TEST tier plans are shown after clicking the TEST tier tab
323+
// Verify >$0 TEST tier plans are shown after clicking the TEST tier tab
312324
await waitFor(() => {
313-
const testPlans = screen.queryAllByTestId('change-plan-label-test_test_monthly');
314-
expect(testPlans.length).toBeGreaterThan(0);
325+
const testPlans = screen.queryAllByTestId(/_test_monthly/);
326+
expect(testPlans).toHaveLength(1);
327+
328+
testPlans.forEach(planLabel => {
329+
expect(within(planLabel).getByText('$50 / monthly')).toBeInTheDocument();
330+
expect(within(planLabel).queryByText('$0 / monthly')).not.toBeInTheDocument();
331+
});
315332
});
316333
});
317334

static/gsAdmin/components/changePlanAction.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ function ChangePlanAction({
108108
return planList.filter(
109109
plan =>
110110
plan.isTestPlan &&
111+
plan.price !== 0 && // filter out enterprise, trial, and free test plans
111112
plan.billingInterval === billingInterval &&
112113
plan.contractInterval === contractInterval
113114
);

0 commit comments

Comments
 (0)