diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/frontend/static_site_editor/graphql | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/frontend/static_site_editor/graphql')
-rw-r--r-- | spec/frontend/static_site_editor/graphql/resolvers/has_submitted_changes_spec.js | 27 |
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, + }, + }, + }); + }); +}); |