diff options
Diffstat (limited to 'spec/frontend/static_site_editor/graphql')
3 files changed, 0 insertions, 89 deletions
diff --git a/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js b/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js deleted file mode 100644 index 83ad23f7dcf..00000000000 --- a/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js +++ /dev/null @@ -1,25 +0,0 @@ -import fileResolver from '~/static_site_editor/graphql/resolvers/file'; -import loadSourceContent from '~/static_site_editor/services/load_source_content'; - -import { - projectId, - sourcePath, - sourceContentTitle as title, - sourceContentYAML as content, -} from '../../mock_data'; - -jest.mock('~/static_site_editor/services/load_source_content', () => jest.fn()); - -describe('static_site_editor/graphql/resolvers/file', () => { - it('returns file content and title when fetching file successfully', () => { - loadSourceContent.mockResolvedValueOnce({ title, content }); - - return fileResolver({ fullPath: projectId }, { path: sourcePath }).then((file) => { - expect(file).toEqual({ - __typename: 'File', - title, - content, - }); - }); - }); -}); 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 deleted file mode 100644 index 0670b240a3f..00000000000 --- a/spec/frontend/static_site_editor/graphql/resolvers/has_submitted_changes_spec.js +++ /dev/null @@ -1,27 +0,0 @@ -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, - }, - }, - }); - }); -}); diff --git a/spec/frontend/static_site_editor/graphql/resolvers/submit_content_changes_spec.js b/spec/frontend/static_site_editor/graphql/resolvers/submit_content_changes_spec.js deleted file mode 100644 index a0529f5f945..00000000000 --- a/spec/frontend/static_site_editor/graphql/resolvers/submit_content_changes_spec.js +++ /dev/null @@ -1,37 +0,0 @@ -import savedContentMetaQuery from '~/static_site_editor/graphql/queries/saved_content_meta.query.graphql'; -import submitContentChangesResolver from '~/static_site_editor/graphql/resolvers/submit_content_changes'; -import submitContentChanges from '~/static_site_editor/services/submit_content_changes'; - -import { - projectId as project, - sourcePath, - username, - sourceContentYAML as content, - savedContentMeta, -} from '../../mock_data'; - -jest.mock('~/static_site_editor/services/submit_content_changes', () => jest.fn()); - -describe('static_site_editor/graphql/resolvers/submit_content_changes', () => { - it('writes savedContentMeta query with the data returned by the submitContentChanges service', () => { - const cache = { writeQuery: jest.fn() }; - - submitContentChanges.mockResolvedValueOnce(savedContentMeta); - - return submitContentChangesResolver( - {}, - { input: { path: sourcePath, project, sourcePath, content, username } }, - { cache }, - ).then(() => { - expect(cache.writeQuery).toHaveBeenCalledWith({ - query: savedContentMetaQuery, - data: { - savedContentMeta: { - __typename: 'SavedContentMeta', - ...savedContentMeta, - }, - }, - }); - }); - }); -}); |