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

file_spec.js « resolvers « graphql « static_site_editor « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8504d09e0f13573f8e3b7fe35811b2f626d65163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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,
  sourceContent 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,
      });
    });
  });
});