@@ -73,15 +73,15 @@ describe('Prefix Groups test', () => {
7373 const editor = await Editor . openProject ( pkg . packageId , pkg )
7474 const result = await editor . run ( {
7575 version : 'prefix2' ,
76- currentGroup : '/api/v3' ,
77- previousGroup : 'api/v2' ,
76+ currentGroup : '/api/v3/ ' ,
77+ previousGroup : '/ api/v2/ ' ,
7878 buildType : BUILD_TYPE . PREFIX_GROUPS_CHANGELOG ,
7979 } )
8080
8181 expect ( result . comparisons ?. [ 0 ] . data ?. length ) . toBe ( 95 )
8282 } )
8383
84- test ( 'should compare prefix groups /api/{group} ' , async ( ) => {
84+ test ( 'should compare prefix groups mixed cases ' , async ( ) => {
8585 const result = await buildPrefixGroupChangelogPackage ( { packageId : 'prefix-groups/mixed-cases' } )
8686
8787 expect ( result ) . toEqual ( changesSummaryMatcher ( {
@@ -102,6 +102,18 @@ describe('Prefix Groups test', () => {
102102 config : { files : [ { fileId : 'spec1.yaml' } , { fileId : 'spec2.yaml' } ] } ,
103103 } )
104104
105+ expect ( result ) . toEqual ( changesSummaryMatcher ( {
106+ [ BREAKING_CHANGE_TYPE ] : 1 ,
107+ [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
108+ [ ANNOTATION_CHANGE_TYPE ] : 1 ,
109+ } ) )
110+ expect ( result ) . toEqual ( numberOfImpactedOperationsMatcher ( {
111+ [ BREAKING_CHANGE_TYPE ] : 1 ,
112+ [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
113+ [ ANNOTATION_CHANGE_TYPE ] : 1 ,
114+ } ) )
115+
116+ //check operation ids
105117 expect ( result ) . toEqual ( operationChangesMatcher ( [
106118 expect . objectContaining ( {
107119 previousOperationId : 'removed-get' ,
@@ -113,16 +125,6 @@ describe('Prefix Groups test', () => {
113125 operationId : 'changed1-get' ,
114126 } ) ,
115127 ] ) )
116- expect ( result ) . toEqual ( changesSummaryMatcher ( {
117- [ BREAKING_CHANGE_TYPE ] : 1 ,
118- [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
119- [ ANNOTATION_CHANGE_TYPE ] : 1 ,
120- } ) )
121- expect ( result ) . toEqual ( numberOfImpactedOperationsMatcher ( {
122- [ BREAKING_CHANGE_TYPE ] : 1 ,
123- [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
124- [ ANNOTATION_CHANGE_TYPE ] : 1 ,
125- } ) )
126128 } )
127129
128130 test ( 'should compare prefix groups when prefix is moved from server to path' , async ( ) => {
@@ -141,6 +143,20 @@ describe('Prefix Groups test', () => {
141143 [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
142144 [ ANNOTATION_CHANGE_TYPE ] : 1 ,
143145 } ) )
146+
147+ //check operation ids
148+ expect ( result ) . toEqual ( operationChangesMatcher ( [
149+ expect . objectContaining ( {
150+ previousOperationId : 'removed-get' ,
151+ } ) ,
152+ expect . objectContaining ( {
153+ operationId : 'changed1-get' ,
154+ previousOperationId : 'changed1-get' ,
155+ } ) ,
156+ expect . objectContaining ( {
157+ operationId : 'added-get' ,
158+ } ) ,
159+ ] ) )
144160 } )
145161
146162 // todo: case that we don't support due to shifting to the new changelog calculation approach which involves comparison of the entire docs instead of the operation vs operation comparison
@@ -178,20 +194,48 @@ describe('Prefix Groups test', () => {
178194 [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
179195 [ ANNOTATION_CHANGE_TYPE ] : 1 ,
180196 } ) )
197+
198+ //check operation ids
199+ expect ( result ) . toEqual ( operationChangesMatcher ( [
200+ expect . objectContaining ( {
201+ previousOperationId : 'added-get' ,
202+ } ) ,
203+ expect . objectContaining ( {
204+ operationId : 'changed1-get' ,
205+ previousOperationId : 'changed1-get' ,
206+ } ) ,
207+ expect . objectContaining ( {
208+ operationId : 'removed-get' ,
209+ } ) ,
210+ ] ) )
181211 } )
182212
183213 test ( 'Add method in a new version' , async ( ) => {
184214 const result = await buildPrefixGroupChangelogPackage ( { packageId : 'prefix-groups/add-method' } )
185215
186216 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ NON_BREAKING_CHANGE_TYPE ] : 1 } ) )
187217 expect ( result ) . toEqual ( numberOfImpactedOperationsMatcher ( { [ NON_BREAKING_CHANGE_TYPE ] : 1 } ) )
218+
219+ //check operation ids
220+ expect ( result ) . toEqual ( operationChangesMatcher ( [
221+ expect . objectContaining ( {
222+ operationId : 'path1-post' ,
223+ } ) ,
224+ ] ) )
188225 } )
189226
190227 test ( 'Remove method in a new version' , async ( ) => {
191228 const result = await buildPrefixGroupChangelogPackage ( { packageId : 'prefix-groups/remove-method' } )
192229
193230 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ BREAKING_CHANGE_TYPE ] : 1 } ) )
194231 expect ( result ) . toEqual ( numberOfImpactedOperationsMatcher ( { [ BREAKING_CHANGE_TYPE ] : 1 } ) )
232+
233+ //check operation ids
234+ expect ( result ) . toEqual ( operationChangesMatcher ( [
235+ expect . objectContaining ( {
236+ previousOperationId : 'path1-post' ,
237+ } ) ,
238+ ] ) )
195239 } )
196240
197241 test ( 'Change method content in a new version' , async ( ) => {
@@ -205,6 +249,14 @@ describe('Prefix Groups test', () => {
205249 [ BREAKING_CHANGE_TYPE ] : 1 ,
206250 [ NON_BREAKING_CHANGE_TYPE ] : 1 ,
207251 } ) )
252+
253+ //check operation ids
254+ expect ( result ) . toEqual ( operationChangesMatcher ( [
255+ expect . objectContaining ( {
256+ operationId : 'path1-get' ,
257+ previousOperationId : 'path1-get' ,
258+ } ) ,
259+ ] ) )
208260 } )
209261
210262 test ( 'should compare prefix groups with different length' , async ( ) => {
@@ -218,6 +270,14 @@ describe('Prefix Groups test', () => {
218270
219271 expect ( result ) . toEqual ( changesSummaryMatcher ( { [ ANNOTATION_CHANGE_TYPE ] : 1 } ) )
220272 expect ( result ) . toEqual ( numberOfImpactedOperationsMatcher ( { [ ANNOTATION_CHANGE_TYPE ] : 1 } ) )
273+
274+ //check operation ids
275+ expect ( result ) . toEqual ( operationChangesMatcher ( [
276+ expect . objectContaining ( {
277+ operationId : 'packages-get' ,
278+ previousOperationId : 'packages-get' ,
279+ } ) ,
280+ ] ) )
221281 } )
222282
223283 // todo add case when api/v1 in servers and api/v2 in some paths?
0 commit comments