@@ -18,21 +18,21 @@ vi.mock('./BundleSelection', () => ({
18
18
default : ( ) => < div > BundleSelection</ div > ,
19
19
} ) )
20
20
21
- const mockRepoOverview = {
21
+ const mockRepoOverview = ( hasDefaultBranch : boolean ) => ( {
22
22
owner : {
23
23
isCurrentUserActivated : true ,
24
24
repository : {
25
25
__typename : 'Repository' ,
26
26
private : false ,
27
- defaultBranch : 'main' ,
27
+ defaultBranch : hasDefaultBranch ? 'main' : null ,
28
28
oldestCommitAt : '2022-10-10T11:59:59' ,
29
29
coverageEnabled : true ,
30
30
bundleAnalysisEnabled : true ,
31
31
languages : [ 'javascript' ] ,
32
32
testAnalyticsEnabled : true ,
33
33
} ,
34
34
} ,
35
- }
35
+ } )
36
36
37
37
const mockBranchBundles = ( isTimescaleEnabled : boolean ) => ( {
38
38
config : { isTimescaleEnabled } ,
@@ -274,13 +274,15 @@ interface SetupArgs {
274
274
isBundleError ?: boolean
275
275
isEmptyBundleSelection ?: boolean
276
276
isTimescaleEnabled ?: boolean
277
+ hasDefaultBranch ?: boolean
277
278
}
278
279
279
280
describe ( 'BundleContent' , ( ) => {
280
281
function setup ( {
281
282
isBundleError = false ,
282
283
isEmptyBundleSelection = false ,
283
284
isTimescaleEnabled = true ,
285
+ hasDefaultBranch = true ,
284
286
} : SetupArgs ) {
285
287
server . use (
286
288
graphql . query ( 'BranchBundleSummaryData' , ( ) => {
@@ -294,7 +296,7 @@ describe('BundleContent', () => {
294
296
} )
295
297
} ) ,
296
298
graphql . query ( 'GetRepoOverview' , ( ) => {
297
- return HttpResponse . json ( { data : mockRepoOverview } )
299
+ return HttpResponse . json ( { data : mockRepoOverview ( hasDefaultBranch ) } )
298
300
} ) ,
299
301
graphql . query ( 'BundleAssets' , ( ) => {
300
302
if ( isBundleError ) {
@@ -446,7 +448,7 @@ describe('BundleContent', () => {
446
448
447
449
describe ( 'when bundle and branch are not set' , ( ) => {
448
450
it ( 'renders no branch selected banner and empty table' , async ( ) => {
449
- setup ( { } )
451
+ setup ( { hasDefaultBranch : false } )
450
452
render ( < BundleContent /> , {
451
453
wrapper : wrapper ( '/gh/codecov/test-repo/bundles' ) ,
452
454
} )
@@ -491,7 +493,7 @@ describe('BundleContent', () => {
491
493
describe ( 'when the bundle type is not BundleAnalysisReport' , ( ) => {
492
494
describe ( 'there is no branch data and no branch set' , ( ) => {
493
495
it ( 'renders the info banner' , async ( ) => {
494
- setup ( { isEmptyBundleSelection : true } )
496
+ setup ( { isEmptyBundleSelection : true , hasDefaultBranch : false } )
495
497
render ( < BundleContent /> , {
496
498
wrapper : wrapper ( '/gh/codecov/test-repo/bundles' ) ,
497
499
} )
0 commit comments