-
-
Notifications
You must be signed in to change notification settings - Fork 74
fix parseHydraDocumentation.test #34
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
Conversation
expect(data).toHaveProperty("response"); | ||
expect(data).toHaveProperty("status"); | ||
}); | ||
let expectedError; |
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.
To avoid issue, can you initialize "expectedError.message"?
For example:
const expectedError = { message: '' }
expect(data).toHaveProperty("response"); | ||
expect(data).toHaveProperty("status"); | ||
}); | ||
let expectedError; |
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.
To avoid issue, can you initialize "expectedError.message"?
For example:
const expectedError = { message: '' }
parseHydraDocumentation("http://localhost/").catch(data => { | ||
expect(data.message).toBe('The API entrypoint has no "@type" key.'); | ||
}); | ||
let expectedError; |
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.
To avoid issue, can you initialize "expectedError.message"?
For example:
const expectedError = { message: '' }
'The API documentation has no "http://www.w3.org/ns/hydra/core#supportedClass" key or its value is not an array.' | ||
); | ||
}); | ||
let expectedError; |
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.
To avoid issue, can you initialize "expectedError.message"?
For example:
const expectedError = { message: '' }
'The entrypoint definition has no "http://www.w3.org/ns/hydra/core#supportedProperty" key or it is not an array.' | ||
); | ||
}); | ||
let expectedError; |
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.
To avoid issue, can you initialize "expectedError.message"?
For example:
const expectedError = { message: '' }
expect(data).toHaveProperty("response"); | ||
expect(data).toHaveProperty("status"); | ||
}); | ||
const expectedError = {}; |
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.
@mauchede : For this test, expectedError should be an empty object ?
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.
Indeed, an empty object should be better.
try { | ||
await parseHydraDocumentation("http://localhost/"); | ||
} catch (error) { | ||
expectedError.api = error.api; |
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.
Change the value of expectedError
: it will be easier than create new properties.
expectedError = error
expect(data).toHaveProperty("response"); | ||
expect(data).toHaveProperty("status"); | ||
}); | ||
const expectedError = {}; |
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.
Indeed, an empty object should be better.
try { | ||
await parseHydraDocumentation("http://localhost/"); | ||
} catch (error) { | ||
expectedError.api = error.api; |
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.
Change the value of expectedError
: it will be easier than create new properties.
expectedError = error
test("Invalid entrypoint JSON", () => { | ||
const entrypoint = `{foo,}`; | ||
test("Invalid entrypoint JSON", async () => { | ||
let entrypoint = `{foo,}`; |
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 did you use backquote here?
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.
I did not change the format, but i think this is suppose to be a JSON string, not a JS Object ? (Like the const entrypoint
)
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.
OK, I did not see than you "only" change const
to let
. Why did you change it (I did not see another assignation of entrypoint
in the test)?
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.
To gain speed because it's one letter less 😄
(Can't remember why, i just rechanged it)
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.
LGTM! Can you squash your commit? I will merge your PR after squashing.
Commits squashed ! |
Nice work @jfthuillier! |
No description provided.