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

add unit tests #56

Merged
merged 2 commits into from
Aug 28, 2019
Merged

add unit tests #56

merged 2 commits into from
Aug 28, 2019

Conversation

m00g3n
Copy link
Contributor

@m00g3n m00g3n commented Aug 28, 2019

Description

  • add unit tests

Related issue(s)
kyma-project/console#684

@m00g3n m00g3n added the enhancement New feature or request label Aug 28, 2019
@@ -50,7 +50,7 @@
"postpack": "rm -rf ./README.md && rm -rf ./LICENSE"
},
"dependencies": {
"asyncapi-parser": "^0.7.0",
"asyncapi-parser": "^0.7.1",
Copy link
Member

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.

) => Promise<AsyncApi>;

export default class Parser {
private parseDocument: ParseDocument;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parse and parseFromURL.

Copy link
Contributor Author

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:

  1. rename class method from parse to do than rename parseDocument to parse and parseDoumentFromURL to parseURL
  2. rename from parseDocument to parseFn (or similar) and parseDoumentFromURto parseURLFn

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. rename to parseSchema{FromURL}

type ParserOptions = AsyncApiProps['parserOptions'];

import { UNSUPPORTED_SCHEMA_VERSION } from '../constants';
type ParseDocument = (
Copy link
Member

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')) {
Copy link
Member

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.

Copy link
Contributor Author

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 return true
  • it is oneliner used just in this place

@m00g3n m00g3n merged commit be65bf4 into asyncapi:master Aug 28, 2019
@m00g3n m00g3n deleted the unit-tests branch August 28, 2019 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants