-
Notifications
You must be signed in to change notification settings - Fork 0
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
Enforce Oneof behavior at execution time #3
base: oneof-validation
Are you sure you want to change the base?
Conversation
describe('Execute: Handles Oneof Input Objects and Oneof Objects', () => { | ||
describe('Oneof Input Objects', () => { | ||
const rootValue = { | ||
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.
Should these tests echo back the oneOf input object argument rather than returning a hard coded literal to ensure the inputs make it all the way through the resolvers?
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.
Good call.
}, | ||
}; | ||
|
||
it('accepts a good default value', () => { |
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.
Do we also need test coverage for field argument defaults and input object input field defaults that use oneOf input objects?
EDIT: I guess the validation for those scenarios is still pending based on graphql#3049.
@@ -221,6 +229,15 @@ describe('valueFromAST', () => { | |||
); | |||
expectValueFrom('{ requiredBool: null }', testInputObj).to.equal(undefined); | |||
expectValueFrom('{ bool: true }', testInputObj).to.equal(undefined); | |||
expectValueFrom('{ a: "abc" }', testOneOfInputObj).to.deep.equal({ |
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.
Is it worth testing a oneOf input object with one key that has a value that can't be coerced e.g. {a: 1}
?
This ensures that we enforce the rules for Oneof Input Objects at execution time.
This ensures the Oneof Objects resolve to an object with exactly one non-null entry.
c13d96a
to
165f2ec
Compare
This enforces the behavior of Oneof Input Object and Oneof Objects during the execution phase of fulfilling a GraphQL request.