Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-26 00:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-26 00:09:13 +0300
commit659ad26b4e0e1f792ab6d15ac8d6e47ec943e214 (patch)
tree5e395d172b681cfe396c671ebf7eef8789ef7334 /spec/frontend_integration
parente93121b42cb4ca672c893c6be0a8af0c8d9f7987 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend_integration')
-rw-r--r--spec/frontend_integration/test_helpers/mock_server/graphql.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/frontend_integration/test_helpers/mock_server/graphql.js b/spec/frontend_integration/test_helpers/mock_server/graphql.js
index e2658852599..27396842523 100644
--- a/spec/frontend_integration/test_helpers/mock_server/graphql.js
+++ b/spec/frontend_integration/test_helpers/mock_server/graphql.js
@@ -1,13 +1,11 @@
import { buildSchema, graphql } from 'graphql';
+import { memoize } from 'lodash';
-/* eslint-disable import/no-unresolved */
-// This rule is disabled for the following line.
// The graphql schema is dynamically generated in CI
// during the `graphql-schema-dump` job.
-import gitlabSchemaStr from '../../../../tmp/tests/graphql/gitlab_schema.graphql';
-/* eslint-enable import/no-unresolved */
+// eslint-disable-next-line global-require, import/no-unresolved
+const getGraphqlSchema = () => require('../../../../tmp/tests/graphql/gitlab_schema.graphql');
-const graphqlSchema = buildSchema(gitlabSchemaStr.loc.source.body);
const graphqlResolvers = {
project({ fullPath }, schema) {
const result = schema.projects.findBy({ path_with_namespace: fullPath });
@@ -21,6 +19,7 @@ const graphqlResolvers = {
};
},
};
+const buildGraphqlSchema = memoize(() => buildSchema(getGraphqlSchema().loc.source.body));
export const graphqlQuery = (query, variables, schema) =>
- graphql(graphqlSchema, query, graphqlResolvers, schema, variables);
+ graphql(buildGraphqlSchema(), query, graphqlResolvers, schema, variables);