Skip to content

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

static/gsApp/components/productTrial/productTrialAlert.spec.tsx

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {render, screen} from 'sentry-test/reactTestingLibrary';
77
import {DataCategory} from 'sentry/types/core';
88

99
import ProductTrialAlert from 'getsentry/components/productTrial/productTrialAlert';
10+
import {getProductForPath} from 'getsentry/components/productTrial/productTrialPaths';
1011
import SubscriptionStore from 'getsentry/stores/subscriptionStore';
1112
import type {ProductTrial} from 'getsentry/types';
1213

@@ -157,3 +158,101 @@ describe('ProductTrialAlert', function () {
157158
).toBeInTheDocument();
158159
});
159160
});
161+
162+
describe('getProductForPath', function () {
163+
const organization = OrganizationFixture();
164+
const subscription = SubscriptionFixture({organization});
165+
166+
it('returns LOG_BYTE product for /explore/logs/ path', function () {
167+
const result = getProductForPath(subscription, '/explore/logs/');
168+
expect(result).toEqual({
169+
product: DataCategory.LOG_BYTE,
170+
categories: [DataCategory.LOG_BYTE],
171+
});
172+
});
173+
174+
it('returns ERRORS product for /issues/ path', function () {
175+
const result = getProductForPath(subscription, '/issues/');
176+
expect(result).toEqual({
177+
product: DataCategory.ERRORS,
178+
categories: [DataCategory.ERRORS],
179+
});
180+
});
181+
182+
it('returns TRANSACTIONS product for /performance/ path', function () {
183+
const result = getProductForPath(subscription, '/performance/');
184+
expect(result).toEqual({
185+
product: DataCategory.TRANSACTIONS,
186+
categories: [DataCategory.TRANSACTIONS],
187+
});
188+
});
189+
190+
it('returns REPLAYS product for /replays/ path', function () {
191+
const result = getProductForPath(subscription, '/replays/');
192+
expect(result).toEqual({
193+
product: DataCategory.REPLAYS,
194+
categories: [DataCategory.REPLAYS],
195+
});
196+
});
197+
198+
it('returns PROFILES product for /profiling/ path', function () {
199+
const result = getProductForPath(subscription, '/profiling/');
200+
expect(result).toEqual({
201+
product: DataCategory.PROFILES,
202+
categories: [DataCategory.PROFILES, DataCategory.TRANSACTIONS],
203+
});
204+
});
205+
206+
it('returns MONITOR_SEATS product for /insights/crons/ path', function () {
207+
const result = getProductForPath(subscription, '/insights/crons/');
208+
expect(result).toEqual({
209+
product: DataCategory.MONITOR_SEATS,
210+
categories: [DataCategory.MONITOR_SEATS],
211+
});
212+
});
213+
214+
it('returns UPTIME product for /insights/uptime/ path', function () {
215+
const result = getProductForPath(subscription, '/insights/uptime/');
216+
expect(result).toEqual({
217+
product: DataCategory.UPTIME,
218+
categories: [DataCategory.UPTIME],
219+
});
220+
});
221+
222+
it('returns TRANSACTIONS product for /traces/ path', function () {
223+
const result = getProductForPath(subscription, '/traces/');
224+
expect(result).toEqual({
225+
product: DataCategory.TRANSACTIONS,
226+
categories: [DataCategory.TRANSACTIONS],
227+
});
228+
});
229+
230+
it('normalizes /explore/traces/ to /traces/', function () {
231+
const result = getProductForPath(subscription, '/explore/traces/');
232+
expect(result).toEqual({
233+
product: DataCategory.TRANSACTIONS,
234+
categories: [DataCategory.TRANSACTIONS],
235+
});
236+
});
237+
238+
it('normalizes /explore/profiling/ to /profiling/', function () {
239+
const result = getProductForPath(subscription, '/explore/profiling/');
240+
expect(result).toEqual({
241+
product: DataCategory.PROFILES,
242+
categories: [DataCategory.PROFILES, DataCategory.TRANSACTIONS],
243+
});
244+
});
245+
246+
it('normalizes /explore/replays/ to /replays/', function () {
247+
const result = getProductForPath(subscription, '/explore/replays/');
248+
expect(result).toEqual({
249+
product: DataCategory.REPLAYS,
250+
categories: [DataCategory.REPLAYS],
251+
});
252+
});
253+
254+
it('returns null for unknown path', function () {
255+
const result = getProductForPath(subscription, '/unknown/');
256+
expect(result).toBeNull();
257+
});
258+
});

static/gsApp/components/productTrial/productTrialPaths.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const PATHS_FOR_PRODUCT_TRIALS: Record<Path, Product> = {
4343
product: DataCategory.TRANSACTIONS,
4444
categories: [DataCategory.TRANSACTIONS],
4545
},
46+
'/logs/': {
47+
product: DataCategory.LOG_BYTE,
48+
categories: [DataCategory.LOG_BYTE],
49+
},
4650
};
4751

4852
const PATHS_FOR_PRODUCT_TRIALS_AM3_OVERRIDES: Record<Path, Product> = {
@@ -76,6 +80,8 @@ function normalizePath(path: string): string {
7680
return '/profiling/';
7781
case '/explore/replays/':
7882
return '/replays/';
83+
case '/explore/logs/':
84+
return '/logs/';
7985
default:
8086
return path;
8187
}

0 commit comments

Comments
 (0)