@@ -14,6 +14,8 @@ import { graphql, HttpResponse } from 'msw'
14
14
import { setupServer } from 'msw/node'
15
15
import { MemoryRouter , Route } from 'react-router-dom'
16
16
17
+ import { IgnoredIdsQueryOptions } from 'pages/CommitDetailPage/queries/IgnoredIdsQueryOptions'
18
+
17
19
import UploadsCard from './UploadsCard'
18
20
import { useUploads } from './useUploads'
19
21
@@ -47,13 +49,17 @@ beforeAll(() => {
47
49
console . error = ( ) => { }
48
50
server . listen ( )
49
51
} )
52
+
50
53
afterEach ( ( ) => {
51
54
queryClient . clear ( )
52
55
queryClientV5 . clear ( )
53
56
server . resetHandlers ( )
54
57
vi . clearAllMocks ( )
55
58
} )
56
- afterAll ( ( ) => server . close ( ) )
59
+
60
+ afterAll ( ( ) => {
61
+ server . close ( )
62
+ } )
57
63
58
64
interface MockCommitErrors {
59
65
data : {
@@ -197,6 +203,7 @@ describe('UploadsCard', () => {
197
203
const covReportHistory = screen . getByText ( / C o v e r a g e r e p o r t s h i s t o r y / )
198
204
expect ( covReportHistory ) . toBeInTheDocument ( )
199
205
} )
206
+
200
207
it ( 'renders different cis' , ( ) => {
201
208
render ( < UploadsCard /> , { wrapper } )
202
209
@@ -205,6 +212,7 @@ describe('UploadsCard', () => {
205
212
const travis = screen . getByText ( / t r a v i s / )
206
213
expect ( travis ) . toBeInTheDocument ( )
207
214
} )
215
+
208
216
it ( 'renders build ids' , ( ) => {
209
217
render ( < UploadsCard /> , { wrapper } )
210
218
@@ -219,6 +227,7 @@ describe('UploadsCard', () => {
219
227
const id5 = screen . getByText ( / 8 3 7 4 6 2 / )
220
228
expect ( id5 ) . toBeInTheDocument ( )
221
229
} )
230
+
222
231
it ( 'renders flags' , ( ) => {
223
232
render ( < UploadsCard /> , { wrapper } )
224
233
@@ -259,6 +268,7 @@ describe('UploadsCard', () => {
259
268
expect ( currentlyNoUploads ) . toBeInTheDocument ( )
260
269
} )
261
270
} )
271
+
262
272
describe ( 'renders empty Uploads' , ( ) => {
263
273
// ??
264
274
beforeEach ( ( ) => {
@@ -280,6 +290,7 @@ describe('UploadsCard', () => {
280
290
expect ( uploads ) . toBeInTheDocument ( )
281
291
} )
282
292
} )
293
+
283
294
describe ( 'The yaml viewer' , ( ) => {
284
295
beforeEach ( ( ) => {
285
296
setup ( {
@@ -819,6 +830,7 @@ describe('UploadsCard', () => {
819
830
} )
820
831
} )
821
832
} )
833
+
822
834
describe ( 'select all interactor' , ( ) => {
823
835
beforeEach ( ( ) => {
824
836
setup ( {
@@ -912,32 +924,47 @@ describe('UploadsCard', () => {
912
924
} )
913
925
} )
914
926
915
- it ( 'unselects all when clicked' , async ( ) => {
916
- const user = userEvent . setup ( )
917
- render ( < UploadsCard /> , { wrapper } )
927
+ describe ( 'unselects all when clicked' , ( ) => {
928
+ it ( 'unselects all when clicked' , async ( ) => {
929
+ const user = userEvent . setup ( )
930
+ render ( < UploadsCard /> , { wrapper } )
918
931
919
- const checkboxes = screen . getAllByRole ( 'checkbox' )
920
- const travisCheckbox = checkboxes [ 0 ]
921
- const travisUploadCheckbox1 = checkboxes [ 1 ]
922
- const travisUploadCheckbox2 = checkboxes [ 2 ]
932
+ const checkboxes = screen . getAllByRole ( 'checkbox' )
933
+ const travisCheckbox = checkboxes [ 0 ]
934
+ const travisUploadCheckbox1 = checkboxes [ 1 ]
935
+ const travisUploadCheckbox2 = checkboxes [ 2 ]
923
936
924
- expect ( travisCheckbox ) . toBeChecked ( )
925
- expect ( travisUploadCheckbox1 ) . toBeChecked ( )
926
- expect ( travisUploadCheckbox2 ) . toBeChecked ( )
937
+ expect ( travisCheckbox ) . toBeChecked ( )
938
+ expect ( travisUploadCheckbox1 ) . toBeChecked ( )
939
+ expect ( travisUploadCheckbox2 ) . toBeChecked ( )
927
940
928
- await user . click ( travisCheckbox ! )
941
+ await user . click ( travisCheckbox ! )
929
942
930
- expect ( travisCheckbox ) . not . toBeChecked ( )
931
- expect ( travisUploadCheckbox1 ) . not . toBeChecked ( )
932
- expect ( travisUploadCheckbox2 ) . not . toBeChecked ( )
933
-
934
- // 'circleci' uploads remain checked
935
- const circleciCheckbox = checkboxes [ 3 ]
936
- const circleciUploadCheckbox1 = checkboxes [ 4 ]
937
- const circleciUploadCheckbox2 = checkboxes [ 5 ]
938
- expect ( circleciCheckbox ) . toBeChecked ( )
939
- expect ( circleciUploadCheckbox1 ) . toBeChecked ( )
940
- expect ( circleciUploadCheckbox2 ) . toBeChecked ( )
943
+ expect ( travisCheckbox ) . not . toBeChecked ( )
944
+ expect ( travisUploadCheckbox1 ) . not . toBeChecked ( )
945
+ expect ( travisUploadCheckbox2 ) . not . toBeChecked ( )
946
+
947
+ // 'circleci' uploads remain checked
948
+ const circleciCheckbox = checkboxes [ 3 ]
949
+ const circleciUploadCheckbox1 = checkboxes [ 4 ]
950
+ const circleciUploadCheckbox2 = checkboxes [ 5 ]
951
+ expect ( circleciCheckbox ) . toBeChecked ( )
952
+ expect ( circleciUploadCheckbox1 ) . toBeChecked ( )
953
+ expect ( circleciUploadCheckbox2 ) . toBeChecked ( )
954
+ } )
955
+
956
+ it ( 'adds ids to ignored ids query' , async ( ) => {
957
+ const user = userEvent . setup ( )
958
+ render ( < UploadsCard /> , { wrapper } )
959
+
960
+ const checkboxes = screen . getAllByRole ( 'checkbox' )
961
+ const travisCheckbox = checkboxes [ 0 ]
962
+ await user . click ( travisCheckbox ! )
963
+
964
+ expect (
965
+ queryClientV5 . getQueryData ( IgnoredIdsQueryOptions ( ) . queryKey )
966
+ ) . toEqual ( [ 0 , 1 ] )
967
+ } )
941
968
} )
942
969
943
970
it ( 'shows an intermediate state' , async ( ) => {
0 commit comments