@@ -45,6 +45,9 @@ import shouldNotMissRemoveDiffForEnumEntryInOneOfAfter from './helper/resources/
4545import shouldReportSingleDiffWhenRequiredPropertyIsChangedForTheCombinerBefore from './helper/resources/should-report-single-diff-when-required-property-is-changed-for-the-combiner/before.json'
4646import shouldReportSingleDiffWhenRequiredPropertyIsChangedForTheCombinerAfter from './helper/resources/should-report-single-diff-when-required-property-is-changed-for-the-combiner/after.json'
4747
48+ import duplicateParametersBefore from './helper/resources/duplicate-parameters/before.json'
49+ import duplicateParametersAfter from './helper/resources/duplicate-parameters/after.json'
50+
4851import { diffsMatcher } from './helper/matchers'
4952import { TEST_DIFF_FLAG , TEST_ORIGINS_FLAG } from './helper'
5053import { JSON_SCHEMA_NODE_SYNTHETIC_TYPE_NOTHING } from '@netcracker/qubership-apihub-api-unifier'
@@ -115,7 +118,7 @@ describe('Real Data', () => {
115118 const after : any = infinityAfter
116119 const { diffs } = apiDiff ( before , after , OPTIONS )
117120 const responseContentPath = [ 'paths' , '/api/v1/dictionaries/dictionary/item' , 'get' , 'responses' , '200' , 'content' ]
118- expect ( diffs ) . toEqual ( diffsMatcher ( [
121+ expect ( diffs ) . toEqual ( diffsMatcher ( [
119122 expect . objectContaining ( {
120123 afterDeclarationPaths : [ [ 'components' , 'schemas' , 'DictionaryItem' , 'x-entity' ] ] ,
121124 afterValue : 'DictionaryItem' ,
@@ -232,7 +235,7 @@ describe('Real Data', () => {
232235 const before : any = wildcardContentSchemaMediaTypeCombinedWithSpecificMediaTypeBefore
233236 const after : any = wildcardContentSchemaMediaTypeCombinedWithSpecificMediaTypeAfter
234237 const { diffs } = apiDiff ( before , after , OPTIONS )
235-
238+
236239 expect ( diffs ) . toEqual ( diffsMatcher ( [
237240 expect . objectContaining ( {
238241 action : DiffAction . replace ,
@@ -302,4 +305,18 @@ describe('Real Data', () => {
302305 } ) ,
303306 ] ) )
304307 } )
308+
309+
310+ it ( 'should not report diffs for duplicated parameters' , ( ) => {
311+ const { diffs } = apiDiff ( duplicateParametersBefore , duplicateParametersAfter , OPTIONS )
312+
313+ expect ( diffs ) . toHaveLength ( 1 )
314+ expect ( diffs ) . toEqual ( diffsMatcher ( [
315+ expect . objectContaining ( {
316+ action : DiffAction . add ,
317+ afterDeclarationPaths : [ [ 'paths' , '/api/v1/user-management/user-federations/{id}/mappers/{id}' , 'get' , 'description' ] ] ,
318+ type : annotation ,
319+ } ) ,
320+ ] ) )
321+ } )
305322} )
0 commit comments