@@ -11,13 +11,13 @@ function testInterpolation(source: string, expected: string): void {
11
11
experimentalFragmentArguments : true ,
12
12
} ) ;
13
13
const transformedDocument = interpolateFragmentArguments ( originalDocument ) ;
14
- expect ( print ( transformedDocument ) ) . to . equal ( dedent ( [ expected ] ) ) ;
14
+ expect ( print ( transformedDocument ) ) . to . equal ( expected ) ;
15
15
}
16
16
17
17
describe ( 'interpolateFragmentArguments' , ( ) => {
18
18
it ( 'should interpolate arguments' , ( ) => {
19
19
testInterpolation (
20
- `
20
+ dedent `
21
21
query TestQuery {
22
22
...MyFragment(fragVar: "hello")
23
23
}
@@ -26,7 +26,7 @@ describe('interpolateFragmentArguments', () => {
26
26
field(arg1: $fragVar)
27
27
}
28
28
` ,
29
- `
29
+ dedent `
30
30
query TestQuery {
31
31
...MyFragment_interpolated_0
32
32
}
@@ -40,7 +40,7 @@ describe('interpolateFragmentArguments', () => {
40
40
41
41
it ( 'should use default value if argument not provided for an explicitly called fragment' , ( ) => {
42
42
testInterpolation (
43
- `
43
+ dedent `
44
44
query TestQuery {
45
45
...MyFragment(fragVar1: "specific")
46
46
}
@@ -49,7 +49,7 @@ describe('interpolateFragmentArguments', () => {
49
49
field(arg1: $fragVar1, arg2: $fragVar2)
50
50
}
51
51
` ,
52
- `
52
+ dedent `
53
53
query TestQuery {
54
54
...MyFragment_interpolated_0
55
55
}
@@ -63,7 +63,7 @@ describe('interpolateFragmentArguments', () => {
63
63
64
64
it ( 'should not use default value if explicit null provided' , ( ) => {
65
65
testInterpolation (
66
- `
66
+ dedent `
67
67
query TestQuery {
68
68
...MyFragment(fragVar1: "specific", fragVar2: null)
69
69
}
@@ -72,7 +72,7 @@ describe('interpolateFragmentArguments', () => {
72
72
field(arg1: $fragVar1, arg2: $fragVar2)
73
73
}
74
74
` ,
75
- `
75
+ dedent `
76
76
query TestQuery {
77
77
...MyFragment_interpolated_0
78
78
}
@@ -86,7 +86,7 @@ describe('interpolateFragmentArguments', () => {
86
86
87
87
it ( 'should generate unique names for multiple interpolations of the same fragment' , ( ) => {
88
88
testInterpolation (
89
- `
89
+ dedent `
90
90
query TestQuery {
91
91
...MyFragment(fragVar: "val1")
92
92
...MyFragment(fragVar: "val2")
@@ -97,7 +97,7 @@ describe('interpolateFragmentArguments', () => {
97
97
field(arg: $fragVar)
98
98
}
99
99
` ,
100
- `
100
+ dedent `
101
101
query TestQuery {
102
102
...MyFragment_interpolated_0
103
103
...MyFragment_interpolated_1
@@ -117,7 +117,7 @@ describe('interpolateFragmentArguments', () => {
117
117
118
118
it ( 'should preserve operation-level variables used in arguments' , ( ) => {
119
119
testInterpolation (
120
- `
120
+ dedent `
121
121
query TestQuery($opVar: String) {
122
122
...MyFragment(fragVar: $opVar)
123
123
}
@@ -126,7 +126,7 @@ describe('interpolateFragmentArguments', () => {
126
126
field(arg: $fragVar)
127
127
}
128
128
` ,
129
- `
129
+ dedent `
130
130
query TestQuery($opVar: String) {
131
131
...MyFragment_interpolated_0
132
132
}
@@ -140,7 +140,7 @@ describe('interpolateFragmentArguments', () => {
140
140
141
141
it ( 'should interpolate a new missing operation variable for missing fragment variables (without defaults)' , ( ) => {
142
142
testInterpolation (
143
- `
143
+ dedent `
144
144
query TestQuery($varWithoutDefault: String) {
145
145
...MyFragment(varWithArg: "supplied")
146
146
}
@@ -150,7 +150,7 @@ describe('interpolateFragmentArguments', () => {
150
150
field2(arg: $varWithoutDefault)
151
151
}
152
152
` ,
153
- `
153
+ dedent `
154
154
query TestQuery($varWithoutDefault: String, $missing_fragment_variable_varWithoutDefault_0: String) {
155
155
...MyFragment_interpolated_0
156
156
}
@@ -165,7 +165,7 @@ describe('interpolateFragmentArguments', () => {
165
165
166
166
it ( 'should interpolate a new missing operation variable for nested missing fragment variables (without defaults)' , ( ) => {
167
167
testInterpolation (
168
- `
168
+ dedent `
169
169
query TestQuery {
170
170
...Outer
171
171
}
@@ -178,7 +178,7 @@ describe('interpolateFragmentArguments', () => {
178
178
field(arg: $varWithoutDefault)
179
179
}
180
180
` ,
181
- `
181
+ dedent `
182
182
query TestQuery($missing_fragment_variable_varWithoutDefault_1: String) {
183
183
...Outer_interpolated_0
184
184
}
@@ -196,7 +196,7 @@ describe('interpolateFragmentArguments', () => {
196
196
197
197
it ( 'should use default for fragment vars even if there is an operation var with the same name' , ( ) => {
198
198
testInterpolation (
199
- `
199
+ dedent `
200
200
query TestQuery($varWithDefaultOnFragment: String) {
201
201
...MyFragment(varWithArg: "supplied")
202
202
}
@@ -206,7 +206,7 @@ describe('interpolateFragmentArguments', () => {
206
206
field2(arg: $varWithDefaultOnFragment)
207
207
}
208
208
` ,
209
- `
209
+ dedent `
210
210
query TestQuery($varWithDefaultOnFragment: String) {
211
211
...MyFragment_interpolated_0
212
212
}
@@ -221,7 +221,7 @@ describe('interpolateFragmentArguments', () => {
221
221
222
222
it ( 'should correctly handle nested fragments with arguments' , ( ) => {
223
223
testInterpolation (
224
- `
224
+ dedent `
225
225
query TestQuery($opVar: String) {
226
226
...OuterFragment(outerVar: "outerValue")
227
227
}
@@ -235,7 +235,7 @@ describe('interpolateFragmentArguments', () => {
235
235
...InnerFragment(innerVar: $outerVar)
236
236
}
237
237
` ,
238
- `
238
+ dedent `
239
239
query TestQuery($opVar: String) {
240
240
...OuterFragment_interpolated_0
241
241
}
@@ -254,7 +254,7 @@ describe('interpolateFragmentArguments', () => {
254
254
255
255
it ( 'should handle fragment spreads with arguments that are lists or objects' , ( ) => {
256
256
testInterpolation (
257
- `
257
+ dedent `
258
258
query TestQuery {
259
259
...MyFragment(listArg: [1, 2], objArg: {a: "val", b: 3})
260
260
}
@@ -263,7 +263,7 @@ describe('interpolateFragmentArguments', () => {
263
263
field(l: $listArg, o: $objArg)
264
264
}
265
265
` ,
266
- `
266
+ dedent `
267
267
query TestQuery {
268
268
...MyFragment_interpolated_0
269
269
}
@@ -277,7 +277,7 @@ describe('interpolateFragmentArguments', () => {
277
277
278
278
it ( 'should handle nested fragment spreads with arguments that are lists or objects, some of which are not provided' , ( ) => {
279
279
testInterpolation (
280
- `
280
+ dedent `
281
281
query Q($opValue: String = "op") {
282
282
...a
283
283
}
@@ -292,7 +292,7 @@ describe('interpolateFragmentArguments', () => {
292
292
cList: list(input: [$cValue])
293
293
}
294
294
` ,
295
- `
295
+ dedent `
296
296
query Q($opValue: String = "op", $missing_fragment_variable_aValue_0: String, $missing_fragment_variable_bValue_0: String, $missing_fragment_variable_cValue_0: String) {
297
297
...a_interpolated_0
298
298
}
@@ -312,7 +312,7 @@ describe('interpolateFragmentArguments', () => {
312
312
313
313
it ( 'should terminate when hitting a fragment cycle' , ( ) => {
314
314
testInterpolation (
315
- `
315
+ dedent `
316
316
{
317
317
...A(arg: "arg")
318
318
}
@@ -329,7 +329,7 @@ describe('interpolateFragmentArguments', () => {
329
329
...A
330
330
}
331
331
` ,
332
- `
332
+ dedent `
333
333
{
334
334
...A_interpolated_0
335
335
}
@@ -351,7 +351,7 @@ describe('interpolateFragmentArguments', () => {
351
351
352
352
it ( 'should ignore unknown fragment arguments' , ( ) => {
353
353
testInterpolation (
354
- `
354
+ dedent `
355
355
{
356
356
...MyFragment(knownArg: "known", unknownArg: "unknown")
357
357
}
@@ -360,7 +360,7 @@ describe('interpolateFragmentArguments', () => {
360
360
field(arg: $knownArg)
361
361
}
362
362
` ,
363
- `
363
+ dedent `
364
364
{
365
365
...MyFragment_interpolated_0
366
366
}
@@ -374,12 +374,12 @@ describe('interpolateFragmentArguments', () => {
374
374
375
375
it ( 'should ignore unknown fragments' , ( ) => {
376
376
testInterpolation (
377
- `
377
+ dedent `
378
378
{
379
379
...MyUnknownFragment(unknownArg: "unknown")
380
380
}
381
381
` ,
382
- `
382
+ dedent `
383
383
{
384
384
...MyUnknownFragment
385
385
}
0 commit comments