summaryrefslogtreecommitdiff
path: root/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend_integration/test_helpers/mock_server/routes/graphql.js')
-rw-r--r--spec/frontend_integration/test_helpers/mock_server/routes/graphql.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js b/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js
new file mode 100644
index 00000000000..ebb5415ba97
--- /dev/null
+++ b/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js
@@ -0,0 +1,11 @@
+import { graphqlQuery } from '../graphql';
+
+export default server => {
+ server.post('/api/graphql', (schema, request) => {
+ const batches = JSON.parse(request.requestBody);
+
+ return Promise.all(
+ batches.map(({ query, variables }) => graphqlQuery(query, variables, schema)),
+ );
+ });
+};