@@ -177,7 +177,7 @@ describe('FailedTestsTable', () => {
177
177
hasNextPage : false ,
178
178
endCursor : null ,
179
179
} ,
180
- totalCount : 1234 ,
180
+ totalCount : 0 ,
181
181
} ,
182
182
} ,
183
183
} ,
@@ -361,19 +361,51 @@ describe('FailedTestsTable', () => {
361
361
} )
362
362
363
363
describe ( 'when first pull request' , ( ) => {
364
- it ( 'renders no data message' , async ( ) => {
365
- const { queryClient } = setup ( { isFirstPullRequest : true } )
366
- render ( < FailedTestsTable /> , {
367
- wrapper : wrapper ( queryClient ) ,
364
+ describe ( 'when there are no test results' , ( ) => {
365
+ it ( 'renders no data message' , async ( ) => {
366
+ const { queryClient } = setup ( {
367
+ isFirstPullRequest : true ,
368
+ noEntries : true ,
369
+ } )
370
+ render ( < FailedTestsTable /> , {
371
+ wrapper : wrapper ( queryClient ) ,
372
+ } )
373
+
374
+ const noDataMessage = await screen . findByText ( 'No data yet' )
375
+ expect ( noDataMessage ) . toBeInTheDocument ( )
376
+
377
+ const mergeIntoMainMessage = await screen . findByText (
378
+ 'To see data for the main branch, merge your PR into the main branch.'
379
+ )
380
+ expect ( mergeIntoMainMessage ) . toBeInTheDocument ( )
368
381
} )
382
+ } )
369
383
370
- const noDataMessage = await screen . findByText ( 'No data yet' )
371
- expect ( noDataMessage ) . toBeInTheDocument ( )
384
+ describe ( 'there are test results' , ( ) => {
385
+ it ( 'renders data in the table' , async ( ) => {
386
+ const { queryClient } = setup ( { isFirstPullRequest : true } )
387
+ render ( < FailedTestsTable /> , {
388
+ wrapper : wrapper ( queryClient ) ,
389
+ } )
390
+
391
+ const nameColumn = await screen . findByText ( 'test-1' )
392
+ expect ( nameColumn ) . toBeInTheDocument ( )
393
+
394
+ const durationColumn = await screen . findByText ( '10.000s' )
395
+ expect ( durationColumn ) . toBeInTheDocument ( )
396
+
397
+ const failureRateColumn = await screen . findByText ( '10.00%' )
398
+ expect ( failureRateColumn ) . toBeInTheDocument ( )
372
399
373
- const mergeIntoMainMessage = await screen . findByText (
374
- 'To see data for the main branch, merge your PR into the main branch.'
375
- )
376
- expect ( mergeIntoMainMessage ) . toBeInTheDocument ( )
400
+ const flakeRateColumn = await screen . findByText ( '0%' )
401
+ expect ( flakeRateColumn ) . toBeInTheDocument ( )
402
+
403
+ const commitFailedColumn = await screen . findByText ( '1' )
404
+ expect ( commitFailedColumn ) . toBeInTheDocument ( )
405
+
406
+ const lastRunColumn = await screen . findAllByText ( 'over 1 year ago' )
407
+ expect ( lastRunColumn . length ) . toBeGreaterThan ( 0 )
408
+ } )
377
409
} )
378
410
} )
379
411
0 commit comments