@@ -18,14 +18,6 @@ import PullBundleAnalysis from './PullBundleAnalysis'
18
18
19
19
import { TBundleAnalysisComparisonResult } from '../queries/PullPageDataQueryOpts'
20
20
21
- const mocks = vi . hoisted ( ( ) => ( {
22
- useFlags : vi . fn ( ) ,
23
- } ) )
24
-
25
- vi . mock ( 'shared/featureFlags' , ( ) => ( {
26
- useFlags : mocks . useFlags ,
27
- } ) )
28
-
29
21
vi . mock ( './EmptyTable' , ( ) => ( {
30
22
default : ( ) => < div > EmptyTable</ div > ,
31
23
} ) )
@@ -159,7 +151,6 @@ interface SetupArgs {
159
151
coverageEnabled ?: boolean
160
152
bundleAnalysisEnabled ?: boolean
161
153
hasCachedBundle ?: boolean
162
- featureFlag ?: boolean
163
154
}
164
155
165
156
describe ( 'PullBundleAnalysis' , ( ) => {
@@ -169,10 +160,7 @@ describe('PullBundleAnalysis', () => {
169
160
coverageEnabled = false ,
170
161
bundleAnalysisEnabled = false ,
171
162
hasCachedBundle = false ,
172
- featureFlag = false ,
173
163
} : SetupArgs ) {
174
- mocks . useFlags . mockReturnValue ( { displayCachedBundleBanner : featureFlag } )
175
-
176
164
server . use (
177
165
graphql . query ( 'PullPageData' , ( ) => {
178
166
return HttpResponse . json ( {
@@ -217,42 +205,38 @@ describe('PullBundleAnalysis', () => {
217
205
expect ( table ) . toBeInTheDocument ( )
218
206
} )
219
207
220
- describe ( 'feature flag is enabled' , ( ) => {
221
- describe ( 'there is a cached bundle' , ( ) => {
222
- it ( 'renders the CachedBundleContentBanner' , async ( ) => {
223
- setup ( {
224
- coverageEnabled : true ,
225
- bundleAnalysisEnabled : true ,
226
- hasCachedBundle : true ,
227
- featureFlag : true ,
228
- } )
229
- render ( < PullBundleAnalysis /> , { wrapper } )
230
-
231
- const cachedBundleContentBanner = await screen . findByText (
232
- 'The reported bundle size includes cached data from previous commits'
233
- )
234
- expect ( cachedBundleContentBanner ) . toBeInTheDocument ( )
208
+ describe ( 'there is a cached bundle' , ( ) => {
209
+ it ( 'renders the CachedBundleContentBanner' , async ( ) => {
210
+ setup ( {
211
+ coverageEnabled : true ,
212
+ bundleAnalysisEnabled : true ,
213
+ hasCachedBundle : true ,
235
214
} )
215
+ render ( < PullBundleAnalysis /> , { wrapper } )
216
+
217
+ const cachedBundleContentBanner = await screen . findByText (
218
+ 'The reported bundle size includes cached data from previous commits'
219
+ )
220
+ expect ( cachedBundleContentBanner ) . toBeInTheDocument ( )
236
221
} )
222
+ } )
237
223
238
- describe ( 'there is not a cached bundle' , ( ) => {
239
- it ( 'does not render the CachedBundleContentBanner' , async ( ) => {
240
- setup ( {
241
- coverageEnabled : true ,
242
- bundleAnalysisEnabled : true ,
243
- hasCachedBundle : false ,
244
- featureFlag : true ,
245
- } )
246
- render ( < PullBundleAnalysis /> , { wrapper } )
247
-
248
- await waitFor ( ( ) => queryClientV5 . isFetching ( ) )
249
- await waitFor ( ( ) => ! queryClientV5 . isFetching ( ) )
250
-
251
- const cachedBundleContentBanner = screen . queryByText (
252
- 'The reported bundle size includes cached data from previous commits'
253
- )
254
- expect ( cachedBundleContentBanner ) . not . toBeInTheDocument ( )
224
+ describe ( 'there is not a cached bundle' , ( ) => {
225
+ it ( 'does not render the CachedBundleContentBanner' , async ( ) => {
226
+ setup ( {
227
+ coverageEnabled : true ,
228
+ bundleAnalysisEnabled : true ,
229
+ hasCachedBundle : false ,
255
230
} )
231
+ render ( < PullBundleAnalysis /> , { wrapper } )
232
+
233
+ await waitFor ( ( ) => queryClientV5 . isFetching ( ) )
234
+ await waitFor ( ( ) => ! queryClientV5 . isFetching ( ) )
235
+
236
+ const cachedBundleContentBanner = screen . queryByText (
237
+ 'The reported bundle size includes cached data from previous commits'
238
+ )
239
+ expect ( cachedBundleContentBanner ) . not . toBeInTheDocument ( )
256
240
} )
257
241
} )
258
242
} )
@@ -371,42 +355,38 @@ describe('PullBundleAnalysis', () => {
371
355
expect ( table ) . toBeInTheDocument ( )
372
356
} )
373
357
374
- describe ( 'feature flag is enabled' , ( ) => {
375
- describe ( 'there is a cached bundle' , ( ) => {
376
- it ( 'renders the CachedBundleContentBanner' , async ( ) => {
377
- setup ( {
378
- coverageEnabled : false ,
379
- bundleAnalysisEnabled : true ,
380
- hasCachedBundle : true ,
381
- featureFlag : true ,
382
- } )
383
- render ( < PullBundleAnalysis /> , { wrapper } )
384
-
385
- const cachedBundleContentBanner = await screen . findByText (
386
- 'The reported bundle size includes cached data from previous commits'
387
- )
388
- expect ( cachedBundleContentBanner ) . toBeInTheDocument ( )
358
+ describe ( 'there is a cached bundle' , ( ) => {
359
+ it ( 'renders the CachedBundleContentBanner' , async ( ) => {
360
+ setup ( {
361
+ coverageEnabled : false ,
362
+ bundleAnalysisEnabled : true ,
363
+ hasCachedBundle : true ,
389
364
} )
365
+ render ( < PullBundleAnalysis /> , { wrapper } )
366
+
367
+ const cachedBundleContentBanner = await screen . findByText (
368
+ 'The reported bundle size includes cached data from previous commits'
369
+ )
370
+ expect ( cachedBundleContentBanner ) . toBeInTheDocument ( )
390
371
} )
372
+ } )
391
373
392
- describe ( 'there is not a cached bundle' , ( ) => {
393
- it ( 'does not render the CachedBundleContentBanner' , async ( ) => {
394
- setup ( {
395
- coverageEnabled : false ,
396
- bundleAnalysisEnabled : true ,
397
- hasCachedBundle : false ,
398
- featureFlag : true ,
399
- } )
400
- render ( < PullBundleAnalysis /> , { wrapper } )
401
-
402
- await waitFor ( ( ) => queryClientV5 . isFetching ( ) )
403
- await waitFor ( ( ) => ! queryClientV5 . isFetching ( ) )
404
-
405
- const cachedBundleContentBanner = screen . queryByText (
406
- 'The reported bundle size includes cached data from previous commits'
407
- )
408
- expect ( cachedBundleContentBanner ) . not . toBeInTheDocument ( )
374
+ describe ( 'there is not a cached bundle' , ( ) => {
375
+ it ( 'does not render the CachedBundleContentBanner' , async ( ) => {
376
+ setup ( {
377
+ coverageEnabled : false ,
378
+ bundleAnalysisEnabled : true ,
379
+ hasCachedBundle : false ,
409
380
} )
381
+ render ( < PullBundleAnalysis /> , { wrapper } )
382
+
383
+ await waitFor ( ( ) => queryClientV5 . isFetching ( ) )
384
+ await waitFor ( ( ) => ! queryClientV5 . isFetching ( ) )
385
+
386
+ const cachedBundleContentBanner = screen . queryByText (
387
+ 'The reported bundle size includes cached data from previous commits'
388
+ )
389
+ expect ( cachedBundleContentBanner ) . not . toBeInTheDocument ( )
410
390
} )
411
391
} )
412
392
} )
0 commit comments