Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replicate incorrect bundling and missing assertions part of #1323 #1389

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b432838
test: replicate incorrect bundling and missing assertions part of #1323
francocm Apr 24, 2024
03ce3a6
Updated assertion styles as per PR feedback as part of https://github…
francocm Apr 26, 2024
e719f24
Fixed incorrect test and incorrect expected files as part of https://…
francocm Apr 26, 2024
c8564ad
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
francocm May 7, 2024
d1c5c19
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
francocm May 9, 2024
1becec0
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
francocm May 9, 2024
d4296c5
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
francocm May 13, 2024
104affb
As per issue raised in https://github.com/APIDevTools/json-schema-ref…
francocm May 13, 2024
3bcdee9
Moved back to validateGeneratedSpec with explicit expects as per PR c…
francocm May 13, 2024
8efa7cf
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 14, 2024
c06a4d4
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 15, 2024
c761c8c
lint fix
francocm May 15, 2024
1fa8a93
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 15, 2024
523b5f2
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 15, 2024
bb0c1fd
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 15, 2024
041f834
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 16, 2024
3fcec67
Merge branch 'master' into fix/1323/bundleNotBundlingExternalFiles
asyncapi-bot May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions test/integration/bundle/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down Expand Up @@ -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;
francocm marked this conversation as resolved.
Show resolved Hide resolved
fileCleanup('./test/integration/bundle/final.yaml');
done();
});
Expand All @@ -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;
francocm marked this conversation as resolved.
Show resolved Hide resolved
fileCleanup('./test/integration/bundle/final.yaml');
done();
});
Expand All @@ -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
francocm marked this conversation as resolved.
Show resolved Hide resolved
fileCleanup('./test/integration/bundle/final.yaml');
done();
});
Expand Down
62 changes: 62 additions & 0 deletions test/integration/bundle/final-asyncapiv3.yaml
Original file line number Diff line number Diff line change
@@ -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'

15 changes: 9 additions & 6 deletions test/integration/bundle/first-asyncapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
type: object
properties:
foo:
type: string
extObjRef:
oneOf:
- $ref: './test/integration/bundle/messages.yaml#/messages/UserSignedUp'
- $ref: './test/integration/bundle/messages.yaml#/messages/UserLoggedOut'
Loading