@@ -201,59 +201,123 @@ describe('Check Api Compatibility Function tests', () => {
201201 } )
202202 } )
203203
204- describe ( 'Publish ApiKind version Labels and file Labels priority tests' , ( ) => {
205- test ( 'should prioritize version label no-BWC over file label BWC in previous version' , async ( ) => {
204+ describe ( 'ApiKind info section tests' , ( ) => {
205+ test ( 'should apply api-kind label in previous document info section' , async ( ) => {
206+ const result = await runApiKindTest ( 'api-kinds/no-bwc-api-kind-info-label-in-prev-document' )
207+ expect ( result ) . toEqual ( changesSummaryMatcher ( { [ RISKY_CHANGE_TYPE ] : 1 } ) )
208+ } )
209+
210+ test ( 'should apply api-kind label in current document info section' , async ( ) => {
211+ const result = await runApiKindTest ( 'api-kinds/no-bwc-api-kind-info-label-in-curr-document' )
212+ expect ( result ) . toEqual ( changesSummaryMatcher ( { [ RISKY_CHANGE_TYPE ] : 1 } ) )
213+ } )
214+ } )
215+
216+ describe ( 'ApiKind operations section tests' , ( ) => {
217+ test ( 'should apply api-kind label in current document operation' , async ( ) => {
218+ const result = await runApiKindTest ( 'api-kinds/no-bwc-api-kind-operation-label-curr-document' )
219+ expect ( result ) . toEqual ( changesSummaryMatcher ( {
220+ [ RISKY_CHANGE_TYPE ] : 1 ,
221+ [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
222+ } ) )
223+ } )
224+
225+ test ( 'should apply api-kind label in previous document operation' , async ( ) => {
226+ const result = await runApiKindTest ( 'api-kinds/no-bwc-api-kind-operation-label-prev-document' )
227+ expect ( result ) . toEqual ( changesSummaryMatcher ( {
228+ [ RISKY_CHANGE_TYPE ] : 1 ,
229+ [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
230+ } ) )
231+ } )
232+ } )
233+
234+ describe ( 'Publish ApiKind Priority tests' , ( ) => {
235+ test ( 'should prioritize version label no-BWC api kind over file label BWC in previous version' , async ( ) => {
206236 const result = await runApiKindTest (
207237 'api-kinds/no-api-kind-in-documents' , [ API_KIND_BWC_LABEL ] , [ ] , [ API_KIND_NO_BWC_LABEL ] ,
208238 )
209239 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ BREAKING_CHANGE_TYPE ] : 1 } ) )
210240 } )
211241
212- test ( 'should prioritize version label no-BWC over file label BWC in current version' , async ( ) => {
242+ test ( 'should prioritize version label no-BWC api kind over file label BWC in current version' , async ( ) => {
213243 const result = await runApiKindTest (
214244 'api-kinds/no-api-kind-in-documents' , [ ] , [ API_KIND_BWC_LABEL ] , [ ] , [ API_KIND_NO_BWC_LABEL ] ,
215245 )
216246 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ BREAKING_CHANGE_TYPE ] : 1 } ) )
217247 } )
218248
219- test ( 'should prioritize file label no-BWC over version label BWC in previous version' , async ( ) => {
249+ test ( 'should prioritize file label no-BWC api kind over version label BWC in previous version' , async ( ) => {
220250 const result = await runApiKindTest (
221251 'api-kinds/no-api-kind-in-documents' , [ API_KIND_NO_BWC_LABEL ] , [ ] , [ API_KIND_BWC_LABEL ] ,
222252 )
223253 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ RISKY_CHANGE_TYPE ] : 1 } ) )
224254 } )
225255
226- test ( 'should prioritize file label no-BWC over version label BWC in current version' , async ( ) => {
256+ test ( 'should prioritize file label no-BWC api kind over version label BWC in current version' , async ( ) => {
227257 const result = await runApiKindTest (
228258 'api-kinds/no-api-kind-in-documents' , [ ] , [ API_KIND_NO_BWC_LABEL ] , [ ] , [ API_KIND_BWC_LABEL ] ,
229259 )
230260 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ RISKY_CHANGE_TYPE ] : 1 } ) )
231261 } )
232- } )
233262
234- describe ( 'ApiKind info section tests' , ( ) => {
235- test ( 'should apply api-kind label in previous document info section' , async ( ) => {
236- const result = await runApiKindTest ( 'api-kinds/api-kind-info-label-in-prev-document' )
263+ test ( 'should prioritize info label no-BWC api kind over version label BWC in previous version' , async ( ) => {
264+ const result = await runApiKindTest (
265+ 'api-kinds/no-bwc-api-kind-info-label-in-prev-document' , [ API_KIND_BWC_LABEL ] , [ ] , [ API_KIND_BWC_LABEL ] ,
266+ )
237267 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ RISKY_CHANGE_TYPE ] : 1 } ) )
238268 } )
239269
240- test ( 'should apply api-kind label in current document info section' , async ( ) => {
241- const result = await runApiKindTest ( 'api-kinds/api-kind-info-label-in-curr-document' )
270+ test ( 'should prioritize info label no-BWC api kind over version label BWC in current version' , async ( ) => {
271+ const result = await runApiKindTest (
272+ 'api-kinds/no-bwc-api-kind-info-label-in-curr-document' , [ ] , [ API_KIND_BWC_LABEL ] , [ ] , [ API_KIND_BWC_LABEL ] ,
273+ )
242274 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ RISKY_CHANGE_TYPE ] : 1 } ) )
243275 } )
244- } )
245276
246- describe ( 'ApiKind operations section tests' , ( ) => {
247- test ( 'should apply api-kind label in current document operation' , async ( ) => {
248- const result = await runApiKindTest ( 'api-kinds/api-kind-operation-label-curr-document' )
277+ test ( 'should prioritize previous info label as BWC when info api-kind overrides no-BWC publish labels' , async ( ) => {
278+ const result = await runApiKindTest (
279+ 'api-kinds/bwc-api-kind-info-label-in-prev-document' , [ API_KIND_NO_BWC_LABEL ] , [ ] , [ API_KIND_NO_BWC_LABEL ] ,
280+ )
281+ expect ( result ) . toEqual ( changesSummaryMatcher ( { [ BREAKING_CHANGE_TYPE ] : 1 } ) )
282+ } )
283+
284+ test ( 'should prioritize current info label as BWC when info api kind overrides no-BWC publish labels' , async ( ) => {
285+ const result = await runApiKindTest (
286+ 'api-kinds/bwc-api-kind-info-label-in-curr-document' , [ ] , [ API_KIND_NO_BWC_LABEL ] , [ ] , [ API_KIND_NO_BWC_LABEL ] ,
287+ )
288+ expect ( result ) . toEqual ( changesSummaryMatcher ( { [ BREAKING_CHANGE_TYPE ] : 1 } ) )
289+ } )
290+
291+ test ( 'should prioritize previous operation-level BWC api kind over current no-BWC publish labels' , async ( ) => {
292+ const result = await runApiKindTest (
293+ 'api-kinds/bwc-api-kind-operation-label-prev-document' , [ ] , [ API_KIND_NO_BWC_LABEL ] , [ ] , [ API_KIND_NO_BWC_LABEL ] ,
294+ )
295+ expect ( result ) . toEqual ( changesSummaryMatcher ( {
296+ [ BREAKING_CHANGE_TYPE ] : 1 ,
297+ [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
298+ } ) )
299+ } )
300+
301+ test ( 'should prioritize current operation-level BWC api kind over current no-BWC publish labels' , async ( ) => {
302+ const result = await runApiKindTest (
303+ 'api-kinds/bwc-api-kind-operation-label-curr-document' , [ ] , [ API_KIND_NO_BWC_LABEL ] , [ ] , [ API_KIND_NO_BWC_LABEL ] ,
304+ )
305+ expect ( result ) . toEqual ( changesSummaryMatcher ( {
306+ [ BREAKING_CHANGE_TYPE ] : 1 ,
307+ [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
308+ } ) )
309+ } )
310+
311+ test ( 'should prioritize current operation-level no-BWC api kind over current BWC info label' , async ( ) => {
312+ const result = await runApiKindTest ( 'api-kinds/double-api-kind-info-label-in-curr-document' )
249313 expect ( result ) . toEqual ( changesSummaryMatcher ( {
250314 [ RISKY_CHANGE_TYPE ] : 1 ,
251315 [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
252316 } ) )
253317 } )
254318
255- test ( 'should apply api-kind label in previous document operation ' , async ( ) => {
256- const result = await runApiKindTest ( 'api-kinds/api-kind-operation -label-prev-document' )
319+ test ( 'should prioritize current operation-level no-BWC api kind over previous BWC info label ' , async ( ) => {
320+ const result = await runApiKindTest ( 'api-kinds/double- api-kind-info -label-in -prev-document' )
257321 expect ( result ) . toEqual ( changesSummaryMatcher ( {
258322 [ RISKY_CHANGE_TYPE ] : 1 ,
259323 [ UNCLASSIFIED_CHANGE_TYPE ] : 1 , // x-api-kind field in the operation also gives a diff
0 commit comments