-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
add unit tests #56
add unit tests #56
Conversation
library/package.json
Outdated
@@ -50,7 +50,7 @@ | |||
"postpack": "rm -rf ./README.md && rm -rf ./LICENSE" | |||
}, | |||
"dependencies": { | |||
"asyncapi-parser": "^0.7.0", | |||
"asyncapi-parser": "^0.7.1", |
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.
Already is 0.8.2
version.
library/src/helpers/parser.ts
Outdated
) => Promise<AsyncApi>; | ||
|
||
export default class Parser { | ||
private parseDocument: ParseDocument; |
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.
parse
and parseFromURL
.
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.
This is the tricky one we have a class that already has parse
method.
I see two solutions:
- rename class method from
parse
todo
than renameparseDocument
toparse
andparseDoumentFromURL
toparseURL
- rename from
parseDocument
toparseFn
(or similar) andparseDoumentFromUR
toparseURLFn
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.
- rename to
parseSchema{FromURL}
type ParserOptions = AsyncApiProps['parserOptions']; | ||
|
||
import { UNSUPPORTED_SCHEMA_VERSION } from '../constants'; | ||
type ParseDocument = ( |
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.
ParseSchema
and ParseSchemaFromURL
err.parsedJSON && | ||
!this.isCorrectSchemaVersion(err.parsedJSON.asyncapi) | ||
) { | ||
if (err.parsedJSON && err.parsedJSON.asyncapi.startsWith('1')) { |
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.
Please revert this to isCorrectSchemaVersion
function.
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.
isCorrectSchemaVersion
only checks the first character e.g.-1.2.3
is not a correct schema version but the function would returntrue
- it is oneliner used just in this place
Description
Related issue(s)
kyma-project/console#684