@apollo/federation-internals 2.4.4 → 2.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Subgraph.d.ts +1 -0
- package/dist/Subgraph.d.ts.map +1 -0
- package/dist/Subgraph.js +2 -0
- package/dist/Subgraph.js.map +1 -0
- package/dist/argumentCompositionStrategies.d.ts +34 -0
- package/dist/argumentCompositionStrategies.d.ts.map +1 -0
- package/dist/argumentCompositionStrategies.js +35 -0
- package/dist/argumentCompositionStrategies.js.map +1 -0
- package/dist/buildSchema.d.ts +10 -0
- package/dist/buildSchema.d.ts.map +1 -0
- package/dist/buildSchema.js +362 -0
- package/dist/buildSchema.js.map +1 -0
- package/dist/coreSpec.d.ts +127 -0
- package/dist/coreSpec.d.ts.map +1 -0
- package/dist/coreSpec.js +590 -0
- package/dist/coreSpec.js.map +1 -0
- package/dist/debug.d.ts +15 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +122 -0
- package/dist/debug.js.map +1 -0
- package/dist/definitions.d.ts +663 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +2841 -0
- package/dist/definitions.js.map +1 -0
- package/dist/directiveAndTypeSpecification.d.ts +67 -0
- package/dist/directiveAndTypeSpecification.d.ts.map +1 -0
- package/dist/directiveAndTypeSpecification.js +271 -0
- package/dist/directiveAndTypeSpecification.js.map +1 -0
- package/dist/error.d.ts +128 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +315 -0
- package/dist/error.js.map +1 -0
- package/dist/extractSubgraphsFromSupergraph.d.ts +8 -0
- package/dist/extractSubgraphsFromSupergraph.d.ts.map +1 -0
- package/dist/extractSubgraphsFromSupergraph.js +576 -0
- package/dist/extractSubgraphsFromSupergraph.js.map +1 -0
- package/dist/federation.d.ts +175 -0
- package/dist/federation.d.ts.map +1 -0
- package/dist/federation.js +1414 -0
- package/dist/federation.js.map +1 -0
- package/dist/federationSpec.d.ts +25 -0
- package/dist/federationSpec.d.ts.map +1 -0
- package/dist/federationSpec.js +125 -0
- package/dist/federationSpec.js.map +1 -0
- package/dist/genErrorCodeDoc.d.ts +2 -0
- package/dist/genErrorCodeDoc.d.ts.map +1 -0
- package/dist/genErrorCodeDoc.js +61 -0
- package/dist/genErrorCodeDoc.js.map +1 -0
- package/dist/graphQLJSSchemaToAST.d.ts +8 -0
- package/dist/graphQLJSSchemaToAST.d.ts.map +1 -0
- package/dist/graphQLJSSchemaToAST.js +96 -0
- package/dist/graphQLJSSchemaToAST.js.map +1 -0
- package/dist/inaccessibleSpec.d.ts +18 -0
- package/dist/inaccessibleSpec.d.ts.map +1 -0
- package/dist/inaccessibleSpec.js +655 -0
- package/dist/inaccessibleSpec.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/introspection.d.ts +6 -0
- package/dist/introspection.d.ts.map +1 -0
- package/dist/introspection.js +96 -0
- package/dist/introspection.js.map +1 -0
- package/dist/joinSpec.d.ts +51 -0
- package/dist/joinSpec.d.ts.map +1 -0
- package/dist/joinSpec.js +160 -0
- package/dist/joinSpec.js.map +1 -0
- package/dist/knownCoreFeatures.d.ts +5 -0
- package/dist/knownCoreFeatures.d.ts.map +1 -0
- package/dist/knownCoreFeatures.js +20 -0
- package/dist/knownCoreFeatures.js.map +1 -0
- package/dist/operations.d.ts +418 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +2068 -0
- package/dist/operations.js.map +1 -0
- package/dist/precompute.d.ts +3 -0
- package/dist/precompute.d.ts.map +1 -0
- package/dist/precompute.js +54 -0
- package/dist/precompute.js.map +1 -0
- package/dist/print.d.ts +28 -0
- package/dist/print.d.ts.map +1 -0
- package/dist/print.js +299 -0
- package/dist/print.js.map +1 -0
- package/dist/schemaUpgrader.d.ts +121 -0
- package/dist/schemaUpgrader.d.ts.map +1 -0
- package/dist/schemaUpgrader.js +570 -0
- package/dist/schemaUpgrader.js.map +1 -0
- package/dist/suggestions.d.ts +3 -0
- package/dist/suggestions.d.ts.map +1 -0
- package/dist/suggestions.js +44 -0
- package/dist/suggestions.js.map +1 -0
- package/dist/supergraphs.d.ts +10 -0
- package/dist/supergraphs.d.ts.map +1 -0
- package/dist/supergraphs.js +76 -0
- package/dist/supergraphs.js.map +1 -0
- package/dist/tagSpec.d.ts +19 -0
- package/dist/tagSpec.d.ts.map +1 -0
- package/dist/tagSpec.js +66 -0
- package/dist/tagSpec.js.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +64 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +64 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +326 -0
- package/dist/utils.js.map +1 -0
- package/dist/validate.d.ts +4 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +239 -0
- package/dist/validate.js.map +1 -0
- package/dist/validation/KnownTypeNamesInFederationRule.d.ts +4 -0
- package/dist/validation/KnownTypeNamesInFederationRule.d.ts.map +1 -0
- package/dist/validation/KnownTypeNamesInFederationRule.js +41 -0
- package/dist/validation/KnownTypeNamesInFederationRule.js.map +1 -0
- package/dist/values.d.ts +23 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/values.js +580 -0
- package/dist/values.js.map +1 -0
- package/package.json +1 -1
- package/src/operations.ts +145 -20
- package/src/utils.ts +1 -1
- package/CHANGELOG.md +0 -205
- package/jest.config.js +0 -11
- package/src/__tests__/coreSpec.test.ts +0 -212
- package/src/__tests__/definitions.test.ts +0 -982
- package/src/__tests__/directiveAndTypeSpecifications.test.ts +0 -41
- package/src/__tests__/extractSubgraphsFromSupergraph.test.ts +0 -748
- package/src/__tests__/federation.test.ts +0 -31
- package/src/__tests__/graphQLJSSchemaToAST.test.ts +0 -156
- package/src/__tests__/matchers/index.ts +0 -1
- package/src/__tests__/matchers/toMatchString.ts +0 -87
- package/src/__tests__/operations.test.ts +0 -1266
- package/src/__tests__/removeInaccessibleElements.test.ts +0 -2471
- package/src/__tests__/schemaUpgrader.test.ts +0 -287
- package/src/__tests__/subgraphValidation.test.ts +0 -1254
- package/src/__tests__/supergraphSdl.graphql +0 -281
- package/src/__tests__/testUtils.ts +0 -28
- package/src/__tests__/toAPISchema.test.ts +0 -53
- package/src/__tests__/tsconfig.json +0 -7
- package/src/__tests__/utils.test.ts +0 -92
- package/src/__tests__/values.test.ts +0 -390
- package/tsconfig.json +0 -10
- package/tsconfig.test.json +0 -8
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Schema,
|
|
3
|
-
} from '../definitions';
|
|
4
|
-
import { buildSchema } from '../buildSchema';
|
|
5
|
-
import { parseOperation } from '../operations';
|
|
6
|
-
import gql from 'graphql-tag';
|
|
7
|
-
import { printSchema } from '../print';
|
|
8
|
-
import { valueEquals } from '../values';
|
|
9
|
-
import { buildForErrors } from './testUtils';
|
|
10
|
-
|
|
11
|
-
function parseSchema(schema: string): Schema {
|
|
12
|
-
try {
|
|
13
|
-
return buildSchema(schema);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
throw new Error('Error parsing the schema:\n' + e.toString());
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
test('handles non-list value for list argument (as singleton)', () => {
|
|
20
|
-
const schema = parseSchema(`
|
|
21
|
-
enum Day {
|
|
22
|
-
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type Query {
|
|
26
|
-
f(v: [Day]): Int
|
|
27
|
-
}
|
|
28
|
-
`);
|
|
29
|
-
|
|
30
|
-
const operation = parseOperation(schema, `
|
|
31
|
-
query {
|
|
32
|
-
f(v: MONDAY)
|
|
33
|
-
}
|
|
34
|
-
`);
|
|
35
|
-
|
|
36
|
-
expect(operation.toString(false, false)).toBe('{ f(v: [MONDAY]) }');
|
|
37
|
-
expect(operation.selectionSet.toSelectionSetNode()).toMatchInlineSnapshot(`
|
|
38
|
-
Object {
|
|
39
|
-
"kind": "SelectionSet",
|
|
40
|
-
"selections": Array [
|
|
41
|
-
Object {
|
|
42
|
-
"alias": undefined,
|
|
43
|
-
"arguments": Array [
|
|
44
|
-
Object {
|
|
45
|
-
"kind": "Argument",
|
|
46
|
-
"name": Object {
|
|
47
|
-
"kind": "Name",
|
|
48
|
-
"value": "v",
|
|
49
|
-
},
|
|
50
|
-
"value": Object {
|
|
51
|
-
"kind": "ListValue",
|
|
52
|
-
"values": Array [
|
|
53
|
-
Object {
|
|
54
|
-
"kind": "EnumValue",
|
|
55
|
-
"value": "MONDAY",
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
"directives": undefined,
|
|
62
|
-
"kind": "Field",
|
|
63
|
-
"name": Object {
|
|
64
|
-
"kind": "Name",
|
|
65
|
-
"value": "f",
|
|
66
|
-
},
|
|
67
|
-
"selectionSet": undefined,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
}
|
|
71
|
-
`);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe('default value validation', () => {
|
|
75
|
-
it('errors on invalid default value in field argument', () => {
|
|
76
|
-
const doc = gql`
|
|
77
|
-
type Query {
|
|
78
|
-
f(a: Int = "foo"): Int
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
83
|
-
'INVALID_GRAPHQL',
|
|
84
|
-
'[S] Invalid default value (got: "foo") provided for argument Query.f(a:) of type Int.'
|
|
85
|
-
]]);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('errors on invalid default value in directive argument', () => {
|
|
89
|
-
const doc = gql`
|
|
90
|
-
type Query {
|
|
91
|
-
f: Int
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
directive @myDirective(a: Int = "foo") on FIELD
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
98
|
-
'INVALID_GRAPHQL',
|
|
99
|
-
'[S] Invalid default value (got: "foo") provided for argument @myDirective(a:) of type Int.'
|
|
100
|
-
]]);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('errors on invalid default value in input field', () => {
|
|
104
|
-
const doc = gql`
|
|
105
|
-
input I {
|
|
106
|
-
x: Int = "foo"
|
|
107
|
-
}
|
|
108
|
-
`;
|
|
109
|
-
|
|
110
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
111
|
-
'INVALID_GRAPHQL',
|
|
112
|
-
'[S] Invalid default value (got: "foo") provided for input field I.x of type Int.'
|
|
113
|
-
]]);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('errors on invalid default value for existing input field', () => {
|
|
117
|
-
const doc = gql`
|
|
118
|
-
type Query {
|
|
119
|
-
f(i: I = { x: 2, y: "3" }): Int
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
input I {
|
|
123
|
-
x: Int
|
|
124
|
-
y: Int
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
129
|
-
'INVALID_GRAPHQL',
|
|
130
|
-
'[S] Invalid default value (got: {x: 2, y: "3"}) provided for argument Query.f(i:) of type I.'
|
|
131
|
-
]]);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('errors on default value containing unexpected input fields', () => {
|
|
135
|
-
const doc = gql`
|
|
136
|
-
type Query {
|
|
137
|
-
f(i: I = { x: 1, y: 2, z: 3 }): Int
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
input I {
|
|
141
|
-
x: Int
|
|
142
|
-
y: Int
|
|
143
|
-
}
|
|
144
|
-
`;
|
|
145
|
-
|
|
146
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
147
|
-
'INVALID_GRAPHQL',
|
|
148
|
-
'[S] Invalid default value (got: {x: 1, y: 2, z: 3}) provided for argument Query.f(i:) of type I.'
|
|
149
|
-
]]);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('errors on default value being unknown enum value', () => {
|
|
153
|
-
const doc = gql`
|
|
154
|
-
type Query {
|
|
155
|
-
f(e: E = THREE): Int
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
enum E {
|
|
159
|
-
ONE
|
|
160
|
-
TWO
|
|
161
|
-
}
|
|
162
|
-
`;
|
|
163
|
-
|
|
164
|
-
// Note that it is slightly imperfect that the error shows the value as a "string" but is the result
|
|
165
|
-
// of enum values being encoded by string value internally (and while, when a value type-check correctly,
|
|
166
|
-
// we can use the type to display enum values properly, this is exactly a case where the value is not
|
|
167
|
-
// correctly type-checked, so we currently don't have a good way to figure out it's an enum when we display
|
|
168
|
-
// it in the error message). We could fix this someday if we change to using a specific class/object for
|
|
169
|
-
// enum values internally (though this might have backward compatbility constraints), but in the meantime,
|
|
170
|
-
// it's unlikely to trip users too much.
|
|
171
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
172
|
-
'INVALID_GRAPHQL',
|
|
173
|
-
'[S] Invalid default value (got: "THREE") provided for argument Query.f(e:) of type E.'
|
|
174
|
-
]]);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('errors on default value being unknown enum value (as string)', () => {
|
|
178
|
-
const doc = gql`
|
|
179
|
-
type Query {
|
|
180
|
-
f(e: E = "TWOO"): Int
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
enum E {
|
|
184
|
-
ONE
|
|
185
|
-
TWO
|
|
186
|
-
}
|
|
187
|
-
`;
|
|
188
|
-
|
|
189
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
190
|
-
'INVALID_GRAPHQL',
|
|
191
|
-
'[S] Invalid default value (got: "TWOO") provided for argument Query.f(e:) of type E.'
|
|
192
|
-
]]);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('accepts default value enum value as string, if a valid enum value', () => {
|
|
196
|
-
// Please note that this test show we accept strings for enum even though the GraphQL spec kind
|
|
197
|
-
// of say we shouldn't. But the graphQL spec also doesn't really do default value validation,
|
|
198
|
-
// which be believe is just wrong, and as a consequence we've seen customer schema with string-for-enum
|
|
199
|
-
// in default values, and it doesn't sound very harmfull to allow it (the spec even admits that some
|
|
200
|
-
// transport may have to deal with enums as string anyway), so we prefer having that allowance in
|
|
201
|
-
// federation (if this ever become a huge issue for some users, we could imagine to add a "strict"
|
|
202
|
-
// more that start refusing this).
|
|
203
|
-
const doc = gql`
|
|
204
|
-
type Query {
|
|
205
|
-
f(e: E = "TWO"): Int
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
enum E {
|
|
209
|
-
ONE
|
|
210
|
-
TWO
|
|
211
|
-
}
|
|
212
|
-
`;
|
|
213
|
-
|
|
214
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('accepts any value for a custom scalar in field agument', () => {
|
|
218
|
-
const doc = gql`
|
|
219
|
-
type Query {
|
|
220
|
-
f(i: Scalar = { x: 2, y: "3" }): Int
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
scalar Scalar
|
|
224
|
-
`;
|
|
225
|
-
|
|
226
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it('accepts any value for a custom scalar in directive agument', () => {
|
|
230
|
-
const doc = gql`
|
|
231
|
-
type Query {
|
|
232
|
-
f: Int
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
directive @myDirective(i: Scalar = { x: 2, y: "3" }) on FIELD
|
|
236
|
-
scalar Scalar
|
|
237
|
-
`;
|
|
238
|
-
|
|
239
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it('accepts any value for a custom scalar in an input field', () => {
|
|
243
|
-
const doc = gql`
|
|
244
|
-
input I {
|
|
245
|
-
x: Scalar = { z: { a: 4} }
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
scalar Scalar
|
|
249
|
-
`;
|
|
250
|
-
|
|
251
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
it('accepts default value coercible to list for a list type', () => {
|
|
255
|
-
const doc = gql`
|
|
256
|
-
type Query {
|
|
257
|
-
f(x: [String] = "foo"): Int
|
|
258
|
-
}
|
|
259
|
-
`;
|
|
260
|
-
|
|
261
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it('accepts default value coercible to list for a list type through multiple coercions', () => {
|
|
265
|
-
const doc = gql`
|
|
266
|
-
type Query {
|
|
267
|
-
f(x: [[[String]!]]! = "foo"): Int
|
|
268
|
-
}
|
|
269
|
-
`;
|
|
270
|
-
|
|
271
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it('errors on default value no coercible to list for a list type through multiple coercions', () => {
|
|
275
|
-
const doc = gql`
|
|
276
|
-
type Query {
|
|
277
|
-
f(x: [[[String]!]]! = 2): Int
|
|
278
|
-
}
|
|
279
|
-
`;
|
|
280
|
-
|
|
281
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
282
|
-
'INVALID_GRAPHQL',
|
|
283
|
-
'[S] Invalid default value (got: 2) provided for argument Query.f(x:) of type [[[String]!]]!.'
|
|
284
|
-
]]);
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
it('accepts default value coercible to its type but needing multiple/nested coercions', () => {
|
|
288
|
-
const doc = gql`
|
|
289
|
-
type Query {
|
|
290
|
-
f(x: I = { j: {x: 1, z: "Foo"} }): Int
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
input I {
|
|
294
|
-
j: [J]
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
input J {
|
|
298
|
-
x: ID
|
|
299
|
-
y: ID
|
|
300
|
-
z: ID
|
|
301
|
-
}
|
|
302
|
-
`;
|
|
303
|
-
|
|
304
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it('accepts default values that, if actually coerced, woudl result in infinite loops', () => {
|
|
308
|
-
// This example is stolen from this comment: https://github.com/graphql/graphql-spec/pull/793#issuecomment-738736539
|
|
309
|
-
// It essentially show that while, as the other tests of this file show, we 1) validate default value against
|
|
310
|
-
// their type and 2) ensures default values coercible to said type don't fail such validation, we also do
|
|
311
|
-
// _not_ do the actual coercion of those values, which in this example would lead to an infinite loop.
|
|
312
|
-
const doc = gql`
|
|
313
|
-
input A {
|
|
314
|
-
b: B = {}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
input B {
|
|
318
|
-
a: A = {}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
type Query {
|
|
322
|
-
q(a: A = {}): Int
|
|
323
|
-
}
|
|
324
|
-
`;
|
|
325
|
-
|
|
326
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
it('errors on null default value for non-nullable input', () => {
|
|
330
|
-
const doc = gql`
|
|
331
|
-
type Query {
|
|
332
|
-
f(i: Int! = null): Int
|
|
333
|
-
}
|
|
334
|
-
`;
|
|
335
|
-
|
|
336
|
-
expect(buildForErrors(doc)).toStrictEqual([[
|
|
337
|
-
'INVALID_GRAPHQL',
|
|
338
|
-
'[S] Invalid default value (got: null) provided for argument Query.f(i:) of type Int!.'
|
|
339
|
-
]]);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
it('Accepts null default value for nullable input', () => {
|
|
343
|
-
const doc = gql`
|
|
344
|
-
type Query {
|
|
345
|
-
f(i: Int = null): Int
|
|
346
|
-
}
|
|
347
|
-
`;
|
|
348
|
-
|
|
349
|
-
expect(buildForErrors(doc)).toBeUndefined();
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
describe('values printing', () => {
|
|
354
|
-
it('prints enums value correctly within multiple lists', () => {
|
|
355
|
-
const sdl = `
|
|
356
|
-
type Query {
|
|
357
|
-
f(a: [[[E]!]!] = [[[FOO], [BAR]]]): Int
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
enum E {
|
|
361
|
-
FOO
|
|
362
|
-
BAR
|
|
363
|
-
}
|
|
364
|
-
`
|
|
365
|
-
expect(printSchema(parseSchema(sdl))).toMatchString(sdl);
|
|
366
|
-
})
|
|
367
|
-
|
|
368
|
-
it('prints enums value when its coercible to list through multiple coercions', () => {
|
|
369
|
-
const sdl = `
|
|
370
|
-
type Query {
|
|
371
|
-
f(a: [[[E]!]!] = FOO): Int
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
enum E {
|
|
375
|
-
FOO
|
|
376
|
-
BAR
|
|
377
|
-
}
|
|
378
|
-
`
|
|
379
|
-
expect(printSchema(parseSchema(sdl))).toMatchString(sdl);
|
|
380
|
-
})
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
describe('objectEquals tests', () => {
|
|
384
|
-
it('simple object equality tests', () => {
|
|
385
|
-
expect(valueEquals({ foo: 'foo' }, { foo: 'foo'})).toBe(true);
|
|
386
|
-
expect(valueEquals({ foo: 'foo', bar: undefined }, { foo: 'foo', bar: undefined})).toBe(true);
|
|
387
|
-
expect(valueEquals({ foo: 'foo' }, { foo: 'foo', bar: undefined})).toBe(false);
|
|
388
|
-
expect(valueEquals({ foo: 'foo', bar: undefined }, { foo: 'foo' })).toBe(false);
|
|
389
|
-
});
|
|
390
|
-
});
|
package/tsconfig.json
DELETED