Skip to content

Commit

Permalink
add less than one value case
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Sep 21, 2024
1 parent d9342ba commit f2a6e9d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/execution/__tests__/variables-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,28 @@ describe('Execute: Handles inputs', () => {
});
});

it('errors with OneOf Input Object with no fields', () => {
const result = executeQuery(`
{
fieldWithOneOfObjectInput(input: {})
}
`);

expectJSON(result).toDeepEqual({
data: {
fieldWithOneOfObjectInput: null,
},
errors: [
{
message:
'Argument "input" of type "TestOneOfInputObject" has invalid value { }.',
path: ['fieldWithOneOfObjectInput'],
locations: [{ line: 3, column: 44 }],
},
],
});
});

it('errors with OneOf Input Object with a single null value', () => {
const result = executeQuery(`
{
Expand Down

0 comments on commit f2a6e9d

Please sign in to comment.