-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapolloMock.js
103 lines (96 loc) · 5.94 KB
/
apolloMock.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { createApolloMock } from 'apollo-typed-documents';
const operations = {};
export default createApolloMock(operations);
operations.authors = {};
operations.authors.variables = (values = {}, options = {}) => {
const __typename = '';
values = (({ }) => ({ }))(values);
values.__typename = __typename;
return {
};
};
operations.authors.data = (values = {}, options = {}) => {
const __typename = '';
values = (({ authors = null }) => ({ authors }))(values);
values.__typename = __typename;
return {
authors: (values.authors || []).map(item => ((values = {}, options = {}) => {
const __typename = 'Author';
values = (({ id = null, createdAt = null, name = null, description = null, books = null }) => ({ id, createdAt, name, description, books }))(values);
values.__typename = __typename;
return {
id: (values.id === null || values.id === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'ID', mappedTypeName: 'string', fieldName: 'id', __typename, scalarValues: options.scalarValues }) : values.id,
createdAt: (values.createdAt === null || values.createdAt === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'Date', mappedTypeName: 'string', fieldName: 'createdAt', __typename, scalarValues: options.scalarValues }) : values.createdAt,
name: (values.name === null || values.name === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'String', mappedTypeName: 'string', fieldName: 'name', __typename, scalarValues: options.scalarValues }) : values.name,
description: values.description,
books: (values.books || []).map(item => ((values = {}, options = {}) => {
const __typename = 'Book';
values = (({ id = null, title = null }) => ({ id, title }))(values);
values.__typename = __typename;
return {
id: (values.id === null || values.id === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'ID', mappedTypeName: 'string', fieldName: 'id', __typename, scalarValues: options.scalarValues }) : values.id,
title: (values.title === null || values.title === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'String', mappedTypeName: 'string', fieldName: 'title', __typename, scalarValues: options.scalarValues }) : values.title,
...(options.addTypename ? { __typename } : {})
};
})(item, options)),
...(options.addTypename ? { __typename } : {})
};
})(item, options))
};
};
operations.createAuthor = {};
operations.createAuthor.variables = (values = {}, options = {}) => {
const __typename = '';
values = (({ input = undefined }) => ({ input }))(values);
values.__typename = __typename;
return {
input: (AuthorInput)(values.input || undefined, options)
};
};
operations.createAuthor.data = (values = {}, options = {}) => {
const __typename = '';
values = (({ createAuthor = null }) => ({ createAuthor }))(values);
values.__typename = __typename;
return {
createAuthor: ((values = {}, options = {}) => {
const __typename = 'Author';
values = (({ id = null, createdAt = null, name = null, description = null, books = null }) => ({ id, createdAt, name, description, books }))(values);
values.__typename = __typename;
return {
id: (values.id === null || values.id === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'ID', mappedTypeName: 'string', fieldName: 'id', __typename, scalarValues: options.scalarValues }) : values.id,
createdAt: (values.createdAt === null || values.createdAt === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'Date', mappedTypeName: 'string', fieldName: 'createdAt', __typename, scalarValues: options.scalarValues }) : values.createdAt,
name: (values.name === null || values.name === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'String', mappedTypeName: 'string', fieldName: 'name', __typename, scalarValues: options.scalarValues }) : values.name,
description: values.description,
books: (values.books || []).map(item => ((values = {}, options = {}) => {
const __typename = 'Book';
values = (({ id = null, title = null }) => ({ id, title }))(values);
values.__typename = __typename;
return {
id: (values.id === null || values.id === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'ID', mappedTypeName: 'string', fieldName: 'id', __typename, scalarValues: options.scalarValues }) : values.id,
title: (values.title === null || values.title === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'String', mappedTypeName: 'string', fieldName: 'title', __typename, scalarValues: options.scalarValues }) : values.title,
...(options.addTypename ? { __typename } : {})
};
})(item, options)),
...(options.addTypename ? { __typename } : {})
};
})(values.createAuthor || undefined, options)
};
};
const BookInput = (values = {}, options = {}) => {
const __typename = 'BookInput';
values = (({ title = undefined }) => ({ title }))(values);
values.__typename = __typename;
return {
title: (values.title === null || values.title === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'String', mappedTypeName: 'string', fieldName: 'title', __typename, scalarValues: options.scalarValues }) : values.title
};
};
const AuthorInput = (values = {}, options = {}) => {
const __typename = 'AuthorInput';
values = (({ books = undefined, description = undefined, name = undefined }) => ({ books, description, name }))(values);
values.__typename = __typename;
return {
books: (values.books || []).map(item => (BookInput)(item, options)),
description: values.description,
name: (values.name === null || values.name === undefined) ? options.getDefaultScalarValue({ scalarTypeName: 'String', mappedTypeName: 'string', fieldName: 'name', __typename, scalarValues: options.scalarValues }) : values.name
};
};