blob: 24651543650d2e791e5f4a18742ead0a5b897263 (
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,
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,
});
});
});
});
|