@@ -7,6 +7,7 @@ import {render, screen} from 'sentry-test/reactTestingLibrary';
7
7
import { DataCategory } from 'sentry/types/core' ;
8
8
9
9
import ProductTrialAlert from 'getsentry/components/productTrial/productTrialAlert' ;
10
+ import { getProductForPath } from 'getsentry/components/productTrial/productTrialPaths' ;
10
11
import SubscriptionStore from 'getsentry/stores/subscriptionStore' ;
11
12
import type { ProductTrial } from 'getsentry/types' ;
12
13
@@ -157,3 +158,101 @@ describe('ProductTrialAlert', function () {
157
158
) . toBeInTheDocument ( ) ;
158
159
} ) ;
159
160
} ) ;
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
+ } ) ;
0 commit comments