Skip to content

Commit 130105d

Browse files
committed
add dedent
1 parent 6448b33 commit 130105d

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/transform/__tests__/interpolateFragmentArguments-test.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ function testInterpolation(source: string, expected: string): void {
1111
experimentalFragmentArguments: true,
1212
});
1313
const transformedDocument = interpolateFragmentArguments(originalDocument);
14-
expect(print(transformedDocument)).to.equal(dedent([expected]));
14+
expect(print(transformedDocument)).to.equal(expected);
1515
}
1616

1717
describe('interpolateFragmentArguments', () => {
1818
it('should interpolate arguments', () => {
1919
testInterpolation(
20-
`
20+
dedent`
2121
query TestQuery {
2222
...MyFragment(fragVar: "hello")
2323
}
@@ -26,7 +26,7 @@ describe('interpolateFragmentArguments', () => {
2626
field(arg1: $fragVar)
2727
}
2828
`,
29-
`
29+
dedent`
3030
query TestQuery {
3131
...MyFragment_interpolated_0
3232
}
@@ -40,7 +40,7 @@ describe('interpolateFragmentArguments', () => {
4040

4141
it('should use default value if argument not provided for an explicitly called fragment', () => {
4242
testInterpolation(
43-
`
43+
dedent`
4444
query TestQuery {
4545
...MyFragment(fragVar1: "specific")
4646
}
@@ -49,7 +49,7 @@ describe('interpolateFragmentArguments', () => {
4949
field(arg1: $fragVar1, arg2: $fragVar2)
5050
}
5151
`,
52-
`
52+
dedent`
5353
query TestQuery {
5454
...MyFragment_interpolated_0
5555
}
@@ -63,7 +63,7 @@ describe('interpolateFragmentArguments', () => {
6363

6464
it('should not use default value if explicit null provided', () => {
6565
testInterpolation(
66-
`
66+
dedent`
6767
query TestQuery {
6868
...MyFragment(fragVar1: "specific", fragVar2: null)
6969
}
@@ -72,7 +72,7 @@ describe('interpolateFragmentArguments', () => {
7272
field(arg1: $fragVar1, arg2: $fragVar2)
7373
}
7474
`,
75-
`
75+
dedent`
7676
query TestQuery {
7777
...MyFragment_interpolated_0
7878
}
@@ -86,7 +86,7 @@ describe('interpolateFragmentArguments', () => {
8686

8787
it('should generate unique names for multiple interpolations of the same fragment', () => {
8888
testInterpolation(
89-
`
89+
dedent`
9090
query TestQuery {
9191
...MyFragment(fragVar: "val1")
9292
...MyFragment(fragVar: "val2")
@@ -97,7 +97,7 @@ describe('interpolateFragmentArguments', () => {
9797
field(arg: $fragVar)
9898
}
9999
`,
100-
`
100+
dedent`
101101
query TestQuery {
102102
...MyFragment_interpolated_0
103103
...MyFragment_interpolated_1
@@ -117,7 +117,7 @@ describe('interpolateFragmentArguments', () => {
117117

118118
it('should preserve operation-level variables used in arguments', () => {
119119
testInterpolation(
120-
`
120+
dedent`
121121
query TestQuery($opVar: String) {
122122
...MyFragment(fragVar: $opVar)
123123
}
@@ -126,7 +126,7 @@ describe('interpolateFragmentArguments', () => {
126126
field(arg: $fragVar)
127127
}
128128
`,
129-
`
129+
dedent`
130130
query TestQuery($opVar: String) {
131131
...MyFragment_interpolated_0
132132
}
@@ -140,7 +140,7 @@ describe('interpolateFragmentArguments', () => {
140140

141141
it('should interpolate a new missing operation variable for missing fragment variables (without defaults)', () => {
142142
testInterpolation(
143-
`
143+
dedent`
144144
query TestQuery($varWithoutDefault: String) {
145145
...MyFragment(varWithArg: "supplied")
146146
}
@@ -150,7 +150,7 @@ describe('interpolateFragmentArguments', () => {
150150
field2(arg: $varWithoutDefault)
151151
}
152152
`,
153-
`
153+
dedent`
154154
query TestQuery($varWithoutDefault: String, $missing_fragment_variable_varWithoutDefault_0: String) {
155155
...MyFragment_interpolated_0
156156
}
@@ -165,7 +165,7 @@ describe('interpolateFragmentArguments', () => {
165165

166166
it('should interpolate a new missing operation variable for nested missing fragment variables (without defaults)', () => {
167167
testInterpolation(
168-
`
168+
dedent`
169169
query TestQuery {
170170
...Outer
171171
}
@@ -178,7 +178,7 @@ describe('interpolateFragmentArguments', () => {
178178
field(arg: $varWithoutDefault)
179179
}
180180
`,
181-
`
181+
dedent`
182182
query TestQuery($missing_fragment_variable_varWithoutDefault_1: String) {
183183
...Outer_interpolated_0
184184
}
@@ -196,7 +196,7 @@ describe('interpolateFragmentArguments', () => {
196196

197197
it('should use default for fragment vars even if there is an operation var with the same name', () => {
198198
testInterpolation(
199-
`
199+
dedent`
200200
query TestQuery($varWithDefaultOnFragment: String) {
201201
...MyFragment(varWithArg: "supplied")
202202
}
@@ -206,7 +206,7 @@ describe('interpolateFragmentArguments', () => {
206206
field2(arg: $varWithDefaultOnFragment)
207207
}
208208
`,
209-
`
209+
dedent`
210210
query TestQuery($varWithDefaultOnFragment: String) {
211211
...MyFragment_interpolated_0
212212
}
@@ -221,7 +221,7 @@ describe('interpolateFragmentArguments', () => {
221221

222222
it('should correctly handle nested fragments with arguments', () => {
223223
testInterpolation(
224-
`
224+
dedent`
225225
query TestQuery($opVar: String) {
226226
...OuterFragment(outerVar: "outerValue")
227227
}
@@ -235,7 +235,7 @@ describe('interpolateFragmentArguments', () => {
235235
...InnerFragment(innerVar: $outerVar)
236236
}
237237
`,
238-
`
238+
dedent`
239239
query TestQuery($opVar: String) {
240240
...OuterFragment_interpolated_0
241241
}
@@ -254,7 +254,7 @@ describe('interpolateFragmentArguments', () => {
254254

255255
it('should handle fragment spreads with arguments that are lists or objects', () => {
256256
testInterpolation(
257-
`
257+
dedent`
258258
query TestQuery {
259259
...MyFragment(listArg: [1, 2], objArg: {a: "val", b: 3})
260260
}
@@ -263,7 +263,7 @@ describe('interpolateFragmentArguments', () => {
263263
field(l: $listArg, o: $objArg)
264264
}
265265
`,
266-
`
266+
dedent`
267267
query TestQuery {
268268
...MyFragment_interpolated_0
269269
}
@@ -277,7 +277,7 @@ describe('interpolateFragmentArguments', () => {
277277

278278
it('should handle nested fragment spreads with arguments that are lists or objects, some of which are not provided', () => {
279279
testInterpolation(
280-
`
280+
dedent`
281281
query Q($opValue: String = "op") {
282282
...a
283283
}
@@ -292,7 +292,7 @@ describe('interpolateFragmentArguments', () => {
292292
cList: list(input: [$cValue])
293293
}
294294
`,
295-
`
295+
dedent`
296296
query Q($opValue: String = "op", $missing_fragment_variable_aValue_0: String, $missing_fragment_variable_bValue_0: String, $missing_fragment_variable_cValue_0: String) {
297297
...a_interpolated_0
298298
}
@@ -312,7 +312,7 @@ describe('interpolateFragmentArguments', () => {
312312

313313
it('should terminate when hitting a fragment cycle', () => {
314314
testInterpolation(
315-
`
315+
dedent`
316316
{
317317
...A(arg: "arg")
318318
}
@@ -329,7 +329,7 @@ describe('interpolateFragmentArguments', () => {
329329
...A
330330
}
331331
`,
332-
`
332+
dedent`
333333
{
334334
...A_interpolated_0
335335
}
@@ -351,7 +351,7 @@ describe('interpolateFragmentArguments', () => {
351351

352352
it('should ignore unknown fragment arguments', () => {
353353
testInterpolation(
354-
`
354+
dedent`
355355
{
356356
...MyFragment(knownArg: "known", unknownArg: "unknown")
357357
}
@@ -360,7 +360,7 @@ describe('interpolateFragmentArguments', () => {
360360
field(arg: $knownArg)
361361
}
362362
`,
363-
`
363+
dedent`
364364
{
365365
...MyFragment_interpolated_0
366366
}
@@ -374,12 +374,12 @@ describe('interpolateFragmentArguments', () => {
374374

375375
it('should ignore unknown fragments', () => {
376376
testInterpolation(
377-
`
377+
dedent`
378378
{
379379
...MyUnknownFragment(unknownArg: "unknown")
380380
}
381381
`,
382-
`
382+
dedent`
383383
{
384384
...MyUnknownFragment
385385
}

0 commit comments

Comments
 (0)