-
Notifications
You must be signed in to change notification settings - Fork 79
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(graphql): add negative test cases for invalid inputs and arguments #783
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.
Non-blocking comments.
const createResult = await createTask(input); | ||
expect(false).toBeTruthy(); |
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.
Does this become more readable as an `expect(async () => await createTask(input).toThrow(/matcher/)
I'm fine as-is, so treat as a question.
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've considered this but we will lose the ability to verify error.errors is defined and error length is greater than 1.
{ or: [ { priority: { between: [1, 2.5] } }, { title: { gt: "test" } } ] }, // Incorrect argument value for between operator with 'or' condition | ||
]; | ||
|
||
await Promise.all( |
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.
Can you pull this block out to a utlity? Then these tests will just be 'data setup'.test basically.
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.
Makes sense. Moved the logic to a separate method.
Codecov Report
@@ Coverage Diff @@
## main #783 +/- ##
=======================================
Coverage 63.39% 63.39%
=======================================
Files 278 278
Lines 18220 18220
Branches 4431 4431
=======================================
Hits 11550 11550
Misses 6074 6074
Partials 596 596 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Description of changes
Add negative test cases for mutations and queries with invalid inputs and arguments.
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.