@@ -27,6 +27,10 @@ import changeToNothingClassificationAfter from './helper/resources/change-to-not
2727import spearedParamsBefore from './helper/resources/speared-parameters/before.json'
2828import spearedParamsAfter from './helper/resources/speared-parameters/after.json'
2929
30+ import wildcardContentSchemaMediaTypeCombinedWithSpecificMediaTypeBefore from './helper/resources/wildcard-content-schema-media-type-combined-with-specific-media-type/before.json'
31+ import wildcardContentSchemaMediaTypeCombinedWithSpecificMediaTypeAfter from './helper/resources/wildcard-content-schema-media-type-combined-with-specific-media-type/after.json'
32+
33+
3034import { diffsMatcher } from './helper/matchers'
3135import { TEST_DIFF_FLAG , TEST_ORIGINS_FLAG } from './helper'
3236import { JSON_SCHEMA_NODE_SYNTHETIC_TYPE_NOTHING } from '@netcracker/qubership-apihub-api-unifier'
@@ -216,4 +220,20 @@ describe('Real Data', () => {
216220 const { diffs } = apiDiff ( before , after , OPTIONS )
217221 expect ( diffs ) . toBeEmpty ( )
218222 } )
223+
224+ // The original issue was that media type was reported as added/removed, when nothing actually changed
225+ it ( 'wildcard content schema media type in combination with specific media type' , ( ) => {
226+ const before : any = wildcardContentSchemaMediaTypeCombinedWithSpecificMediaTypeBefore
227+ const after : any = wildcardContentSchemaMediaTypeCombinedWithSpecificMediaTypeAfter
228+ const { diffs } = apiDiff ( before , after , OPTIONS )
229+
230+ expect ( diffs ) . toEqual ( diffsMatcher ( [
231+ expect . objectContaining ( {
232+ action : DiffAction . replace ,
233+ beforeDeclarationPaths : [ [ 'servers' , 0 , 'url' ] ] ,
234+ afterDeclarationPaths : [ [ 'servers' , 0 , 'url' ] ] ,
235+ type : annotation ,
236+ } ) ,
237+ ] ) )
238+ } )
219239} )
0 commit comments