diff --git a/test/integration/bundle/bundle.test.ts b/test/integration/bundle/bundle.test.ts index 0cc20e7cb31..4b32fa243a5 100644 --- a/test/integration/bundle/bundle.test.ts +++ b/test/integration/bundle/bundle.test.ts @@ -4,6 +4,7 @@ import path from 'path'; import { fileCleanup } from '../../helpers'; const spec = fs.readFileSync('./test/integration/bundle/final-asyncapi.yaml', {encoding: 'utf-8'}); +const specv3 = fs.readFileSync('./test/integration/bundle/final-asyncapiv3.yaml', {encoding: 'utf-8'}); function validateGeneratedSpec(filePath: string, spec: string) { const generatedSPec = fs.readFileSync(path.resolve(filePath), { encoding: 'utf-8' }); @@ -67,7 +68,7 @@ describe('bundle', () => { ]) .it('should be able to bundle multiple specs along with custom reference', (ctx, done) => { expect(ctx.stdout).to.contain('Check out your shiny new bundled files at test/integration/bundle/final.yaml\n'); - expect(validateGeneratedSpec('test/integration/bundle/final.yaml', spec)); + expect(validateGeneratedSpec('test/integration/bundle/final.yaml', spec)).to.be.true; fileCleanup('./test/integration/bundle/final.yaml'); done(); }); @@ -79,7 +80,7 @@ describe('bundle', () => { ]) .it('should be able to bundle correctly with overwriting base file', (ctx, done) => { expect(ctx.stdout).to.contain('Check out your shiny new bundled files at test/integration/bundle/final.yaml\n'); - expect(validateGeneratedSpec('test/integration/bundle/final-asyncapi.yaml', spec)); + expect(validateGeneratedSpec('test/integration/bundle/final-asyncapi.yaml', spec)).to.be.true; fileCleanup('./test/integration/bundle/final.yaml'); done(); }); @@ -93,6 +94,7 @@ describe('bundle spec v3', () => { '--output=test/integration/bundle/final.yaml', ]).it('should be able to bundle v3 spec correctly', (ctx, done) => { expect(ctx.stdout).to.contain('Check out your shiny new bundled files at test/integration/bundle/final.yaml\n'); + expect(validateGeneratedSpec('test/integration/bundle/final.yaml', specv3)).to.be.true fileCleanup('./test/integration/bundle/final.yaml'); done(); }); diff --git a/test/integration/bundle/final-asyncapiv3.yaml b/test/integration/bundle/final-asyncapiv3.yaml new file mode 100644 index 00000000000..9d09321960f --- /dev/null +++ b/test/integration/bundle/final-asyncapiv3.yaml @@ -0,0 +1,62 @@ +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: This service is in charge of processing user signups +channels: + userSignedup: + address: 'user/signedup' + messages: + userSignedUpMessage: + $ref: '#/components/messages/UserSignedUp' + test: + address: '/test' + messages: + testMessage: + $ref: '#/components/messages/TestMessage' +operations: + UserSignedUp: + action: send + channel: + $ref: '#/channels/userSignedup' + TestOpp: + action: send + channel: + $ref: '#/channels/test' +components: + messages: + UserSignedUp: + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user + UserLoggedOut: + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + userId: + type: string + description: Id the user + timestamp: + type: number + description: Time stamp when the user logged out + TestMessage: + payload: + type: object + properties: + foo: + type: string + extObjRef: + oneOf: + - $ref: '#/components/messages/UserSignedUp' + - $ref: '#/components/messages/UserLoggedOut' + diff --git a/test/integration/bundle/first-asyncapiv3.yaml b/test/integration/bundle/first-asyncapiv3.yaml index 117d7bad68c..d48dfbcbe8b 100644 --- a/test/integration/bundle/first-asyncapiv3.yaml +++ b/test/integration/bundle/first-asyncapiv3.yaml @@ -12,23 +12,26 @@ channels: test: address: '/test' messages: - testMessage: + message: $ref: '#/components/messages/TestMessage' operations: UserSignedUp: action: send channel: $ref: '#/channels/userSignedup' - messages: - - $ref: './test/integration/bundle/messages.yaml#/messages/UserSignedUp' TestOpp: action: send channel: $ref: '#/channels/test' - messages: - - $ref: '#/components/messages/TestMessage' components: messages: TestMessage: payload: - type: string \ No newline at end of file + type: object + properties: + foo: + type: string + extObjRef: + oneOf: + - $ref: './test/integration/bundle/messages.yaml#/messages/UserSignedUp' + - $ref: './test/integration/bundle/messages.yaml#/messages/UserLoggedOut'