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
Fix #115: added test cases for sentiment analysis #207
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.
Looking good. Just a couple of suggestions, feel free to dismiss them.
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.
|
||
test('test if sample text does not return the correct object', async () => { | ||
const data = await sentimentAnalysis.run('I like dogs, but my girlfriend is afraid of them'); | ||
expect(data).toEqual(expect.not.objectContaining(expected)); |
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 not just compare data
to expected
with a deep equals here? What does .toEqual(expect.not.objectContaining(expected))
mean? Maybe you're right, but this seems odd.
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.
@humphd From what I have read, .toEqual
should be used for objects. Regards to expect.not.objectContaining(expected)
, I am using this to check if the contents(properties) of the object do not match what we are expecting. This was suggested by @jatinAroraGit and after reading the docs I agreed to his suggestion.
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.
Interesting, OK, sounds fine. Thanks for educating me.
This pull request is to address #115 . I wrote two test cases that will test if sentiment analysis functionality will a) return the unexpected object b) return the expected object.
@jatinAroraGit would love to see your feedback on the following tests.