@@ -373,114 +373,88 @@ describe('Check Api Compatibility Function tests', () => {
373373 } )
374374 } )
375375
376+ const OPERATION_RISKY_CHANGE_TYPES = {
377+ [ RISKY_CHANGE_TYPE ] : 1 ,
378+ [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
379+ }
380+
381+ const OPERATION_BREAKING_CHANGE_TYPES = {
382+ [ BREAKING_CHANGE_TYPE ] : 1 ,
383+ [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
384+ }
385+
376386 describe ( 'ApiKind operations section tests' , ( ) => {
377387 test ( 'should apply operation no-BWC in current document' , async ( ) => {
378388 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-curr-document' )
379- expect ( result ) . toEqual ( changesSummaryMatcher ( {
380- [ RISKY_CHANGE_TYPE ] : 1 ,
381- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
382- } ) )
389+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
383390 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
384391 } )
385392
386393 test ( 'should apply operation no-BWC in previous document' , async ( ) => {
387394 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-prev-document' )
388- expect ( result ) . toEqual ( changesSummaryMatcher ( {
389- [ RISKY_CHANGE_TYPE ] : 1 ,
390- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
391- } ) )
395+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
392396 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
393397 } )
394398
395399 test ( 'should prioritize operation no-BWC property in current document over operation BWC property in previous document' , async ( ) => {
396400 const result = await runApiKindTest ( 'api-kinds/operation-bwc-in-prev-document-operation-noBWC-in-curr-document' )
397- expect ( result ) . toEqual ( changesSummaryMatcher ( {
398- [ RISKY_CHANGE_TYPE ] : 1 ,
399- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
400- } ) )
401+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
401402 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
402403 } )
403404
404405 test ( 'should prioritize operation no-BWC property in previous document over operation BWC property in current document' , async ( ) => {
405406 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-prev-document-operation-bwc-in-curr-document' )
406- expect ( result ) . toEqual ( changesSummaryMatcher ( {
407- [ RISKY_CHANGE_TYPE ] : 1 ,
408- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
409- } ) )
407+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
410408 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
411409 } )
412410 } )
413411
414412 describe ( 'Priority operation ApiKind and default ApiKind' , ( ) => {
415413 test ( 'should prioritize parent no-BWC in previous document over operation BWC property in current document' , async ( ) => {
416414 const result = await runApiKindTest ( 'api-kinds/operation-bwc-in-curr-document' , [ API_KIND_NO_BWC_LABEL ] )
417- expect ( result ) . toEqual ( changesSummaryMatcher ( {
418- [ RISKY_CHANGE_TYPE ] : 1 ,
419- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
420- } ) )
415+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
421416 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
422417 } )
423418
424419 test ( 'should prioritize operation BWC property in current document over default no-BWC in current document' , async ( ) => {
425420 const result = await runApiKindTest ( 'api-kinds/operation-bwc-in-curr-document' , [ ] , [ API_KIND_NO_BWC_LABEL ] )
426- expect ( result ) . toEqual ( changesSummaryMatcher ( {
427- [ BREAKING_CHANGE_TYPE ] : 1 ,
428- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
429- } ) )
421+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_BREAKING_CHANGE_TYPES ) )
430422 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( BREAKING_CHANGE_TYPE ) )
431423 } )
432424
433425 test ( 'should prioritize operation BWC property in previous document over default no-BWC in previous document' , async ( ) => {
434426 const result = await runApiKindTest ( 'api-kinds/operation-bwc-in-prev-document' , [ API_KIND_NO_BWC_LABEL ] )
435- expect ( result ) . toEqual ( changesSummaryMatcher ( {
436- [ BREAKING_CHANGE_TYPE ] : 1 ,
437- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
438- } ) )
427+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_BREAKING_CHANGE_TYPES ) )
439428 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( BREAKING_CHANGE_TYPE ) )
440429 } )
441430
442431 test ( 'should prioritize default no-BWC in current document over operation BWC in previous document' , async ( ) => {
443432 const result = await runApiKindTest ( 'api-kinds/operation-bwc-in-prev-document' , [ ] , [ API_KIND_NO_BWC_LABEL ] )
444- expect ( result ) . toEqual ( changesSummaryMatcher ( {
445- [ RISKY_CHANGE_TYPE ] : 1 ,
446- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
447- } ) )
433+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
448434 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
449435 } )
450436
451437 test ( 'should prioritize operation no-BWC property in current document over default BWC in previous document' , async ( ) => {
452438 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-curr-document' , [ API_KIND_BWC_LABEL ] )
453- expect ( result ) . toEqual ( changesSummaryMatcher ( {
454- [ RISKY_CHANGE_TYPE ] : 1 ,
455- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
456- } ) )
439+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
457440 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
458441 } )
459442
460443 test ( 'should prioritize operation no-BWC property in current document over default BWC in current document' , async ( ) => {
461444 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-curr-document' , [ ] , [ API_KIND_BWC_LABEL ] )
462- expect ( result ) . toEqual ( changesSummaryMatcher ( {
463- [ RISKY_CHANGE_TYPE ] : 1 ,
464- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
465- } ) )
445+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
466446 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
467447 } )
468448
469449 test ( 'should prioritize operation no-BWC property in previous document over default BWC in previous document' , async ( ) => {
470450 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-prev-document' , [ API_KIND_BWC_LABEL ] )
471- expect ( result ) . toEqual ( changesSummaryMatcher ( {
472- [ RISKY_CHANGE_TYPE ] : 1 ,
473- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
474- } ) )
451+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
475452 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
476453 } )
477454
478455 test ( 'should prioritize operation no-BWC property in previous document over default BWC in current document' , async ( ) => {
479456 const result = await runApiKindTest ( 'api-kinds/operation-noBWC-in-prev-document' , [ ] , [ API_KIND_BWC_LABEL ] )
480- expect ( result ) . toEqual ( changesSummaryMatcher ( {
481- [ RISKY_CHANGE_TYPE ] : 1 ,
482- [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
483- } ) )
457+ expect ( result ) . toEqual ( changesSummaryMatcher ( OPERATION_RISKY_CHANGE_TYPES ) )
484458 expect ( result ) . toEqual ( serializedComparisonDocumentMatcher ( RISKY_CHANGE_TYPE ) )
485459 } )
486460 } )
0 commit comments