@@ -209,7 +209,7 @@ describe('[integration testing] bundler should ', () => {
209209 } ,
210210 messages : [
211211 {
212- $ref : '#/channels/lightTurnOn/ messages/turnOn ' ,
212+ $ref : '#/components/ messages/turnOnOff ' ,
213213 } ,
214214 ] ,
215215 } ,
@@ -220,7 +220,7 @@ describe('[integration testing] bundler should ', () => {
220220 } ,
221221 messages : [
222222 {
223- $ref : '#/channels/lightTurnOff/ messages/turnOff ' ,
223+ $ref : '#/components/ messages/turnOnOff ' ,
224224 } ,
225225 ] ,
226226 } ,
@@ -233,7 +233,7 @@ describe('[integration testing] bundler should ', () => {
233233 'Inform about environmental lighting conditions of a particular streetlight.' ,
234234 messages : [
235235 {
236- $ref : '#/channels/lightingMeasured /messages/lightMeasured' ,
236+ $ref : '#/components /messages/lightMeasured' ,
237237 } ,
238238 ] ,
239239 } ,
@@ -415,16 +415,50 @@ describe('[integration testing] bundler should ', () => {
415415 } ) ;
416416
417417 test ( 'should not throw if circular `$ref` exists and derefrence for circular references is ignored for multiple files' , async ( ) => {
418+ const resultingObject = {
419+ asyncapi : '3.0.0' ,
420+ info : {
421+ title : 'Test model' ,
422+ version : '1.0.0' ,
423+ } ,
424+ components : {
425+ messages : {
426+ btree : {
427+ title : 'BTree' ,
428+ payload : {
429+ $schema : 'https://json-schema.org/draft-07/schema#' ,
430+ title : 'BTree' ,
431+ type : 'object' ,
432+ properties : {
433+ root : {
434+ $schema : 'https://json-schema.org/draft-07/schema#' ,
435+ title : 'Node' ,
436+ type : 'object' ,
437+ properties : {
438+ left : {
439+ $ref : '#/components/messages/btree/payload/properties/root'
440+ } ,
441+ right : {
442+ $ref : '#/components/messages/btree/payload/properties/root'
443+ } ,
444+ } ,
445+ } ,
446+ } ,
447+ } ,
448+ } ,
449+ } ,
450+ } ,
451+ } ;
452+
418453 const files = [ 'asyncapi.yaml' ] ;
419454
420455 const response = await bundle ( files , {
421456 xOrigin : true ,
422457 baseDir : path . resolve ( process . cwd ( ) , './tests/circular' ) ,
423458 dereference : 'ignore-circular' ,
424459 } ) ;
425- // console.log('ignore');
426- // console.log(response.yml());
427- expect ( response ) . resolves ;
460+
461+ expect ( response . json ( ) ) . toMatchObject ( resultingObject ) ;
428462 } ) ;
429463} ) ;
430464
0 commit comments