This repository was archived by the owner on Dec 19, 2023. It is now read-only.
add support for testing with graphql fragments #344
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR is to meet a need discovered recently while writing tens of tests using the same return types, and discovering that the
GraphQLTestTemplatedoesn't support querying with fragments (or at least not obviously):For example, given the following graphqls query resource files:
some-fragment.graphqlssome-query-using-fragment.graphqlsgraphQLTestTemplate.postForResource('graphql/some-query-using-fragment.graphqls')will fail.Proposed Solution
This PR adds overloaded methods to
GraphQLTestTemplate#postForResourceandGraphQLTestTemplate#perform, so that the above scenario can be handled with:And can be applied to an arbitrary number of fragments.