diff --git a/src/execution/__tests__/oneof-test.ts b/src/execution/__tests__/oneof-test.ts index af0e0580ab..eda808d246 100644 --- a/src/execution/__tests__/oneof-test.ts +++ b/src/execution/__tests__/oneof-test.ts @@ -134,6 +134,30 @@ describe('Execute: Handles OneOf Input Objects', () => { }); }); + it('accepts multiple variable key as long as only one has a value', () => { + // NOTE: This is an *invalid* query, but it should be an *executable* query. + const query = ` + query ($a: String, $b: String) { + test(input: { a: $a, b: $b }) { + a + b + } + } + `; + const result = executeQuery(query, rootValue, { + a: 'abc', + }); + + expectJSON(result).toDeepEqual({ + data: { + test: { + a: 'abc', + b: null, + }, + }, + }); + }); + it('rejects a variable with multiple non-null keys', () => { const query = ` query ($input: TestInputObject!) {