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>2020-10-16 09:08:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-16 09:08:48 +0300
commite94d662e5aabd4918de373b37c4f084325c7c1f8 (patch)
tree0b2cfdcc08258329318dcbf4412266893f7616d6 /spec/frontend/static_site_editor
parentc311ce331fcfe1c1f1619534eb746245a1deb326 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/static_site_editor')
-rw-r--r--spec/frontend/static_site_editor/graphql/resolvers/has_submitted_changes_spec.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/frontend/static_site_editor/graphql/resolvers/has_submitted_changes_spec.js b/spec/frontend/static_site_editor/graphql/resolvers/has_submitted_changes_spec.js
new file mode 100644
index 00000000000..0670b240a3f
--- /dev/null
+++ b/spec/frontend/static_site_editor/graphql/resolvers/has_submitted_changes_spec.js
@@ -0,0 +1,27 @@
+import appDataQuery from '~/static_site_editor/graphql/queries/app_data.query.graphql';
+import hasSubmittedChanges from '~/static_site_editor/graphql/resolvers/has_submitted_changes';
+
+describe('static_site_editor/graphql/resolvers/has_submitted_changes', () => {
+ it('updates the cache with the data passed in input', () => {
+ const cachedData = { appData: { original: 'foo' } };
+ const newValue = { input: { hasSubmittedChanges: true } };
+
+ const cache = {
+ readQuery: jest.fn().mockReturnValue(cachedData),
+ writeQuery: jest.fn(),
+ };
+ hasSubmittedChanges(null, newValue, { cache });
+
+ expect(cache.readQuery).toHaveBeenCalledWith({ query: appDataQuery });
+ expect(cache.writeQuery).toHaveBeenCalledWith({
+ query: appDataQuery,
+ data: {
+ appData: {
+ __typename: 'AppData',
+ original: 'foo',
+ hasSubmittedChanges: true,
+ },
+ },
+ });
+ });
+});