@@ -261,8 +261,8 @@ describe('<DebugContainer />', () => {
261
261
{ id : 'a1c' , groupIds : [ 'a' ] } ,
262
262
] as DebugSpecListSpecFragment [ ]
263
263
const tests = [
264
- { specId : 'a1c' , id : 'random1' } ,
265
- { specId : 'a1c' , id : 'random2' } ,
264
+ { specId : 'a1c' , id : 'random1' , thumbprint : 'unique1' } ,
265
+ { specId : 'a1c' , id : 'random2' , thumbprint : 'unique2' } ,
266
266
] as DebugSpecListTestsFragment [ ]
267
267
const groups = [
268
268
{ id : 'a' , testingType : 'e2e' } ,
@@ -272,7 +272,16 @@ describe('<DebugContainer />', () => {
272
272
const debugMappingArray = specsList ( { specs, tests, groups, localSpecs : [ ] , currentTestingType : 'e2e' } )
273
273
274
274
expect ( debugMappingArray ) . to . have . length ( 1 )
275
- expect ( debugMappingArray [ 0 ] ) . to . deep . equal ( { spec : { id : 'a1c' , groupIds : [ 'a' ] } , tests : [ { specId : 'a1c' , id : 'random1' } , { specId : 'a1c' , id : 'random2' } ] , groups : [ { id : 'a' , testingType : 'e2e' } ] , foundLocally : false , testingType : 'e2e' , matchesCurrentTestingType : true } )
275
+ expect ( debugMappingArray ) . to . have . eql ( [
276
+ {
277
+ spec : { id : 'a1c' , groupIds : [ 'a' ] } ,
278
+ tests : { 'unique1' : [ { specId : 'a1c' , id : 'random1' , thumbprint : 'unique1' } ] , 'unique2' : [ { specId : 'a1c' , id : 'random2' , thumbprint : 'unique2' } ] } ,
279
+ groups : { 'a' : { id : 'a' , testingType : 'e2e' } } ,
280
+ foundLocally : false ,
281
+ testingType : 'e2e' ,
282
+ matchesCurrentTestingType : true ,
283
+ } ,
284
+ ] )
276
285
} )
277
286
278
287
it ( 'maps correctly for multiple specs and test' , ( ) => {
@@ -282,23 +291,48 @@ describe('<DebugContainer />', () => {
282
291
{ id : '789' , groupIds : [ 'a' , 'b' ] } ,
283
292
] as DebugSpecListSpecFragment [ ]
284
293
const tests = [
285
- { specId : '123' , id : 'random1' } ,
286
- { specId : '456' , id : 'random2' } ,
287
- { specId : '456' , id : 'random3' } ,
288
- { specId : '789' , id : 'random4' } ,
289
- { specId : '123' , id : 'random6' } ,
294
+ { specId : '123' , id : 'random1' , thumbprint : 'unique1' } ,
295
+ { specId : '456' , id : 'random2' , thumbprint : 'unique2' } ,
296
+ { specId : '456' , id : 'random3' , thumbprint : 'unique3' } ,
297
+ { specId : '789' , id : 'random4' , thumbprint : 'unique4' } ,
298
+ { specId : '123' , id : 'random6' , thumbprint : 'unique5' } ,
299
+ { specId : '789' , id : 'random7' , thumbprint : 'unique4' } ,
290
300
] as DebugSpecListTestsFragment [ ]
291
301
const groups = [
292
302
{ id : 'a' , testingType : 'e2e' } ,
293
303
{ id : 'b' , testingType : 'e2e' } ,
294
304
] as DebugSpecListGroupsFragment [ ]
295
305
296
306
const debugMappingArray = specsList ( { specs, tests, localSpecs : [ ] , currentTestingType : 'e2e' , groups } )
307
+ const expectedSpec123 = {
308
+ spec : { id : '123' , groupIds : [ 'a' ] } ,
309
+ tests : { 'unique1' : [ { specId : '123' , id : 'random1' , thumbprint : 'unique1' } ] , 'unique5' : [ { specId : '123' , id : 'random6' , thumbprint : 'unique5' } ] } ,
310
+ groups : { 'a' : { id : 'a' , testingType : 'e2e' } } ,
311
+ foundLocally : false ,
312
+ testingType : 'e2e' ,
313
+ matchesCurrentTestingType : true ,
314
+ }
315
+
316
+ const expectedSpec456 = {
317
+ spec : { id : '456' , groupIds : [ 'b' ] } ,
318
+ tests : { 'unique2' : [ { specId : '456' , id : 'random2' , thumbprint : 'unique2' } ] , 'unique3' : [ { specId : '456' , id : 'random3' , thumbprint : 'unique3' } ] } ,
319
+ groups : { 'b' : { id : 'b' , testingType : 'e2e' } } ,
320
+ foundLocally : false ,
321
+ testingType : 'e2e' ,
322
+ matchesCurrentTestingType : true ,
323
+ }
324
+
325
+ const expectedSpec789 = {
326
+ spec : { id : '789' , groupIds : [ 'a' , 'b' ] } ,
327
+ tests : { 'unique4' : [ { specId : '789' , id : 'random4' , thumbprint : 'unique4' } , { specId : '789' , id : 'random7' , thumbprint : 'unique4' } ] } ,
328
+ groups : { 'a' : { id : 'a' , testingType : 'e2e' } , 'b' : { id : 'b' , testingType : 'e2e' } } ,
329
+ foundLocally : false ,
330
+ testingType : 'e2e' ,
331
+ matchesCurrentTestingType : true ,
332
+ }
297
333
298
334
const expected = [
299
- { spec : { id : '123' , groupIds : [ 'a' ] } , tests : [ { specId : '123' , id : 'random1' } , { specId : '123' , id : 'random6' } ] , groups : [ { id : 'a' , testingType : 'e2e' } ] , foundLocally : false , testingType : 'e2e' , matchesCurrentTestingType : true } ,
300
- { spec : { id : '456' , groupIds : [ 'b' ] } , tests : [ { specId : '456' , id : 'random2' } , { specId : '456' , id : 'random3' } ] , groups : [ { id : 'b' , testingType : 'e2e' } ] , foundLocally : false , testingType : 'e2e' , matchesCurrentTestingType : true } ,
301
- { spec : { id : '789' , groupIds : [ 'a' , 'b' ] } , tests : [ { specId : '789' , id : 'random4' } ] , groups : [ { id : 'a' , testingType : 'e2e' } , { id : 'b' , testingType : 'e2e' } ] , foundLocally : false , testingType : 'e2e' , matchesCurrentTestingType : true } ,
335
+ expectedSpec123 , expectedSpec456 , expectedSpec789 ,
302
336
]
303
337
304
338
expect ( debugMappingArray ) . to . deep . equal ( expected )
@@ -310,13 +344,23 @@ describe('<DebugContainer />', () => {
310
344
{ id : '456' , groupIds : [ 'a' ] } ,
311
345
{ id : '789' , groupIds : [ 'a' ] } ,
312
346
] as DebugSpecListSpecFragment [ ]
313
- const tests = [ { specId : '123' , id : 'random1' } ] as DebugSpecListTestsFragment [ ]
347
+ const tests = [ { specId : '123' , id : 'random1' , thumbprint : 'unique1' } ] as DebugSpecListTestsFragment [ ]
314
348
const groups = [ { id : 'a' , testingType : 'e2e' } ] as DebugSpecListGroupsFragment [ ]
315
349
316
350
const debugMappingArray = specsList ( { specs, tests, localSpecs : [ ] , currentTestingType : 'e2e' , groups } )
317
351
318
- expect ( debugMappingArray ) . to . have . length ( 1 )
319
- expect ( debugMappingArray ) . to . deep . equal ( [ { spec : { id : '123' , groupIds : [ 'a' ] } , tests : [ { specId : '123' , id : 'random1' } ] , groups : [ { id : 'a' , testingType : 'e2e' } ] , foundLocally : false , testingType : 'e2e' , matchesCurrentTestingType : true } ] )
352
+ expect ( debugMappingArray ) . to . deep . equal (
353
+ [
354
+ {
355
+ spec : { id : '123' , groupIds : [ 'a' ] } ,
356
+ tests : { 'unique1' : [ { specId : '123' , id : 'random1' , thumbprint : 'unique1' } ] } ,
357
+ groups : { 'a' : { id : 'a' , testingType : 'e2e' } } ,
358
+ foundLocally : false ,
359
+ testingType : 'e2e' ,
360
+ matchesCurrentTestingType : true ,
361
+ } ,
362
+ ] ,
363
+ )
320
364
} )
321
365
322
366
it ( 'throws an error when a test does not map to a spec' , ( ) => {
0 commit comments