@@ -36,8 +36,10 @@ describe('parse()', function () {
3636 channels : { } ,
3737 } ;
3838 const { document, diagnostics } = await parser . parse ( documentRaw ) ;
39+ // Ignore asyncapi-latest-version diagnostic - not relevant to this test and would require updating version each release
40+ const filteredDiagnostics = diagnostics . filter ( d => d . code !== 'asyncapi-latest-version' ) ;
3941 expect ( document ) . toBeInstanceOf ( AsyncAPIDocumentV3 ) ;
40- expect ( diagnostics . length === 0 ) . toEqual ( true ) ;
42+ expect ( filteredDiagnostics . length === 0 ) . toEqual ( true ) ;
4143 } ) ;
4244
4345 it ( 'should parse invalid document' , async function ( ) {
@@ -361,9 +363,11 @@ describe('parse()', function () {
361363 description: Email of the user` ;
362364
363365 const { document, diagnostics } = await parser . parse ( documentRaw ) ;
366+ // Ignore asyncapi-latest-version diagnostic - not relevant to this test and would require updating version each release
367+ const filteredDiagnostics = diagnostics . filter ( d => d . code !== 'asyncapi-latest-version' ) ;
364368
365369 expect ( document ) . toBeInstanceOf ( AsyncAPIDocumentV3 ) ;
366- expect ( diagnostics . length === 0 ) . toEqual ( true ) ;
370+ expect ( filteredDiagnostics . length === 0 ) . toEqual ( true ) ;
367371 } ) ;
368372
369373 it ( 'should parse valid v3 JSON document in JSON format' , async function ( ) {
@@ -420,19 +424,23 @@ describe('parse()', function () {
420424 } ;
421425
422426 const { document, diagnostics } = await parser . parse ( documentRaw ) ;
427+ // Ignore asyncapi-latest-version diagnostic - not relevant to this test and would require updating version each release
428+ const filteredDiagnostics = diagnostics . filter ( d => d . code !== 'asyncapi-latest-version' ) ;
423429
424430 expect ( document ) . toBeInstanceOf ( AsyncAPIDocumentV3 ) ;
425- expect ( diagnostics . length === 0 ) . toEqual ( true ) ;
431+ expect ( filteredDiagnostics . length === 0 ) . toEqual ( true ) ;
426432 } ) ;
427433
428434 it ( 'should parse valid v3 JSON document after JSON.stringify()' , async function ( ) {
429435 const documentRaw =
430436 '{\n "asyncapi": "3.0.0",\n "info": {\n "title": "Account Service",\n "version": "1.0.0",\n "description": "This service is in charge of processing user signups"\n },\n "channels": {\n "userSignedup": {\n "address": "user/signedup",\n "messages": {\n "UserSignedUp": {\n "$ref": "#/components/messages/UserSignedUp"\n }\n }\n }\n },\n "operations": {\n "sendUserSignedup": {\n "action": "send",\n "channel": {\n "$ref": "#/channels/userSignedup"\n },\n "messages": [\n {\n "$ref": "#/channels/userSignedup/messages/UserSignedUp"\n }\n ]\n }\n },\n "components": {\n "messages": {\n "UserSignedUp": {\n "payload": {\n "type": "object",\n "properties": {\n "displayName": {\n "type": "string",\n "description": "Name of the user"\n },\n "email": {\n "type": "string",\n "format": "email",\n "description": "Email of the user"\n }\n }\n }\n }\n }\n }\n}\n' ;
431437
432438 const { document, diagnostics } = await parser . parse ( documentRaw ) ;
439+ // Ignore asyncapi-latest-version diagnostic - not relevant to this test and would require updating version each release
440+ const filteredDiagnostics = diagnostics . filter ( d => d . code !== 'asyncapi-latest-version' ) ;
433441
434442 expect ( document ) . toBeInstanceOf ( AsyncAPIDocumentV3 ) ;
435- expect ( diagnostics . length === 0 ) . toEqual ( true ) ;
443+ expect ( filteredDiagnostics . length === 0 ) . toEqual ( true ) ;
436444 } ) ;
437445
438446 it ( 'should not parse invalid v3 YAML document and give error in line 153 (#936)' , async function ( ) {
@@ -767,9 +775,11 @@ components:
767775 bindingVersion: '0.3.0'` ;
768776
769777 const { document, diagnostics } = await parser . parse ( documentRaw ) ;
778+ // Ignore asyncapi-latest-version diagnostic - not relevant to this test and would require updating version each release
779+ const filteredDiagnostics = diagnostics . filter ( d => d . code !== 'asyncapi-latest-version' ) ;
770780
771781 expect ( document ) . not . toBeInstanceOf ( AsyncAPIDocumentV3 ) ;
772- expect ( diagnostics [ 0 ] . range . start . line === 153 ) . toEqual ( true ) ;
782+ expect ( filteredDiagnostics [ 0 ] . range . start . line === 153 ) . toEqual ( true ) ;
773783 } ) ;
774784
775785 it ( 'should not parse invalid v3 JSON document and give error in line 236 (#936)' , async function ( ) {
@@ -1269,8 +1279,10 @@ components:
12691279 } ;
12701280
12711281 const { document, diagnostics } = await parser . parse ( documentRaw ) ;
1282+ // Ignore asyncapi-latest-version diagnostic - not relevant to this test and would require updating version each release
1283+ const filteredDiagnostics = diagnostics . filter ( d => d . code !== 'asyncapi-latest-version' ) ;
12721284
12731285 expect ( document ) . not . toBeInstanceOf ( AsyncAPIDocumentV3 ) ;
1274- expect ( diagnostics [ 0 ] . range . start . line === 236 ) . toEqual ( true ) ;
1286+ expect ( filteredDiagnostics [ 0 ] . range . start . line === 236 ) . toEqual ( true ) ;
12751287 } ) ;
12761288} ) ;
0 commit comments