-
-
Notifications
You must be signed in to change notification settings - Fork 257
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: adding tests for template websockets components #1351
base: master
Are you sure you want to change the base?
test: adding tests for template websockets components #1351
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try writing tests without mocks included but reuse maybe https://github.com/asyncapi/generator/blob/master/packages/helpers/test/__fixtures__/asyncapi-websocket-query.yml like this: https://github.com/asyncapi/generator/blob/master/packages/components/test/components/models.test.js#L6
and then, if it works, that we "cross-use" fixtures between projects, maybe the file should be moved to a "generic" test fixtures folder
Updated the PR with suggested changes 👍🏻 |
|
const info = { | ||
title: () => parsedAsyncAPIDocument.info.title, | ||
version: () => parsedAsyncAPIDocument.info.version, | ||
}; | ||
|
||
const serverWithPathname = { | ||
protocol: () => parsedAsyncAPIDocument.servers()[3].protocol(), | ||
host: () => parsedAsyncAPIDocument.servers()[3].host(), | ||
pathname: () => parsedAsyncAPIDocument.servers()[3].pathname(), | ||
hasPathname: () => true | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you still want to maintain this code if you already have parsedAsyncAPIDocument
and can access data using parser?
you have this
const wrapperWithoutPathname = FileHeaderInfo({ info, server: serverWithoutPathname });
so why not refactor to this
const wrapperWithoutPathname = FileHeaderInfo({ parsedAsyncAPIDocument.info(), parsedAsyncAPIDocument.servers().get('withPathname') });
Description
Adding testing files for template websockets component:
Requires
andFileHeaderInfo
Related issue(s)
fixes: #1346, #1347, #1348
Tests are running file locally
Screenshots