Skip to content

Commit

Permalink
reproduction #4741
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Mar 31, 2023
1 parent 7a2d597 commit 7cb909b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/loaders/json-schema/test/execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,33 @@ describe('Execution', () => {
expect(receivedInput).toEqual(expectedInput);
});
});
it('List results', async () => {
const schema = await loadGraphQLSchemaFromJSONSchemas('test', {
cwd: __dirname,
operations: [
{
type: OperationTypeNode.QUERY,
field: 'getTest',
method: 'GET',
path: '/test',
responseSchema: './fixtures/list-results.schema.json#/definitions/Test',
},
],
fetch: async () => Response.json(['foo', 'bar', 'baz']),
});
const query = /* GraphQL */ `
query Test {
getTest
}
`;
const result = await execute({
schema,
document: parse(query),
});
expect(result).toEqual({
data: {
getTest: ['foo', 'bar', 'baz'],
},
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"definitions": {
"Test": {
"type": "array",
"title": "Test",
"description": "Test Object",
"items": {
"type": "string"
}
}
}
}

0 comments on commit 7cb909b

Please sign in to comment.