Skip to content

Commit 7895fba

Browse files
tests: Fix style of graphql queries inside string literals (#2287)
1 parent fbed2c2 commit 7895fba

File tree

4 files changed

+178
-150
lines changed

4 files changed

+178
-150
lines changed

src/execution/__tests__/abstract-promise-test.js

+85-71
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,19 @@ describe('Execute: Handles execution of abstract types with promises', () => {
8686
types: [CatType, DogType],
8787
});
8888

89-
const query = `{
90-
pets {
91-
name
92-
... on Dog {
93-
woofs
94-
}
95-
... on Cat {
96-
meows
89+
const query = `
90+
{
91+
pets {
92+
name
93+
... on Dog {
94+
woofs
95+
}
96+
... on Cat {
97+
meows
98+
}
9799
}
98100
}
99-
}`;
101+
`;
100102

101103
const result = await graphql(schema, query);
102104

@@ -159,17 +161,19 @@ describe('Execute: Handles execution of abstract types with promises', () => {
159161
types: [CatType, DogType],
160162
});
161163

162-
const query = `{
163-
pets {
164-
name
165-
... on Dog {
166-
woofs
167-
}
168-
... on Cat {
169-
meows
164+
const query = `
165+
{
166+
pets {
167+
name
168+
... on Dog {
169+
woofs
170+
}
171+
... on Cat {
172+
meows
173+
}
170174
}
171175
}
172-
}`;
176+
`;
173177

174178
const result = await graphql(schema, query);
175179

@@ -180,12 +184,12 @@ describe('Execute: Handles execution of abstract types with promises', () => {
180184
errors: [
181185
{
182186
message: 'We are testing this error',
183-
locations: [{ line: 2, column: 7 }],
187+
locations: [{ line: 3, column: 9 }],
184188
path: ['pets', 0],
185189
},
186190
{
187191
message: 'We are testing this error',
188-
locations: [{ line: 2, column: 7 }],
192+
locations: [{ line: 3, column: 9 }],
189193
path: ['pets', 1],
190194
},
191195
],
@@ -230,18 +234,20 @@ describe('Execute: Handles execution of abstract types with promises', () => {
230234
}),
231235
});
232236

233-
const query = `{
234-
pets {
235-
... on Dog {
236-
name
237-
woofs
238-
}
239-
... on Cat {
240-
name
241-
meows
237+
const query = `
238+
{
239+
pets {
240+
... on Dog {
241+
name
242+
woofs
243+
}
244+
... on Cat {
245+
name
246+
meows
247+
}
242248
}
243249
}
244-
}`;
250+
`;
245251

246252
const result = await graphql(schema, query);
247253

@@ -324,17 +330,19 @@ describe('Execute: Handles execution of abstract types with promises', () => {
324330
types: [CatType, DogType],
325331
});
326332

327-
const query = `{
328-
pets {
329-
name
330-
... on Dog {
331-
woofs
332-
}
333-
... on Cat {
334-
meows
333+
const query = `
334+
{
335+
pets {
336+
name
337+
... on Dog {
338+
woofs
339+
}
340+
... on Cat {
341+
meows
342+
}
335343
}
336344
}
337-
}`;
345+
`;
338346

339347
const result = await graphql(schema, query);
340348

@@ -356,7 +364,7 @@ describe('Execute: Handles execution of abstract types with promises', () => {
356364
{
357365
message:
358366
'Runtime Object type "Human" is not a possible type for "Pet".',
359-
locations: [{ line: 2, column: 7 }],
367+
locations: [{ line: 3, column: 9 }],
360368
path: ['pets', 2],
361369
},
362370
],
@@ -421,18 +429,20 @@ describe('Execute: Handles execution of abstract types with promises', () => {
421429
}),
422430
});
423431

424-
const query = `{
425-
pets {
426-
... on Dog {
427-
name
428-
woofs
429-
}
430-
... on Cat {
431-
name
432-
meows
432+
const query = `
433+
{
434+
pets {
435+
... on Dog {
436+
name
437+
woofs
438+
}
439+
... on Cat {
440+
name
441+
meows
442+
}
433443
}
434444
}
435-
}`;
445+
`;
436446

437447
const result = await graphql(schema, query);
438448

@@ -454,7 +464,7 @@ describe('Execute: Handles execution of abstract types with promises', () => {
454464
{
455465
message:
456466
'Runtime Object type "Human" is not a possible type for "Pet".',
457-
locations: [{ line: 2, column: 7 }],
467+
locations: [{ line: 3, column: 9 }],
458468
path: ['pets', 2],
459469
},
460470
],
@@ -507,17 +517,19 @@ describe('Execute: Handles execution of abstract types with promises', () => {
507517
types: [CatType, DogType],
508518
});
509519

510-
const query = `{
511-
pets {
512-
name
513-
... on Dog {
514-
woofs
515-
}
516-
... on Cat {
517-
meows
520+
const query = `
521+
{
522+
pets {
523+
name
524+
... on Dog {
525+
woofs
526+
}
527+
... on Cat {
528+
meows
529+
}
518530
}
519531
}
520-
}`;
532+
`;
521533

522534
const result = await graphql(schema, query);
523535

@@ -579,17 +591,19 @@ describe('Execute: Handles execution of abstract types with promises', () => {
579591
types: [CatType, DogType],
580592
});
581593

582-
const query = `{
583-
pets {
584-
name
585-
... on Dog {
586-
woofs
587-
}
588-
... on Cat {
589-
meows
594+
const query = `
595+
{
596+
pets {
597+
name
598+
... on Dog {
599+
woofs
600+
}
601+
... on Cat {
602+
meows
603+
}
590604
}
591605
}
592-
}`;
606+
`;
593607

594608
const result = await graphql(schema, query);
595609

@@ -600,12 +614,12 @@ describe('Execute: Handles execution of abstract types with promises', () => {
600614
errors: [
601615
{
602616
message: 'We are testing this error',
603-
locations: [{ line: 2, column: 7 }],
617+
locations: [{ line: 3, column: 9 }],
604618
path: ['pets', 0],
605619
},
606620
{
607621
message: 'We are testing this error',
608-
locations: [{ line: 2, column: 7 }],
622+
locations: [{ line: 3, column: 9 }],
609623
path: ['pets', 1],
610624
},
611625
],

src/execution/__tests__/abstract-test.js

+47-39
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,19 @@ describe('Execute: Handles execution of abstract types', () => {
8686
types: [CatType, DogType],
8787
});
8888

89-
const query = `{
90-
pets {
91-
name
92-
... on Dog {
93-
woofs
94-
}
95-
... on Cat {
96-
meows
89+
const query = `
90+
{
91+
pets {
92+
name
93+
... on Dog {
94+
woofs
95+
}
96+
... on Cat {
97+
meows
98+
}
9799
}
98100
}
99-
}`;
101+
`;
100102

101103
const result = graphqlSync(schema, query);
102104

@@ -246,17 +248,19 @@ describe('Execute: Handles execution of abstract types', () => {
246248
types: [CatType, DogType],
247249
});
248250

249-
const query = `{
250-
pets {
251-
name
252-
... on Dog {
253-
woofs
254-
}
255-
... on Cat {
256-
meows
251+
const query = `
252+
{
253+
pets {
254+
name
255+
... on Dog {
256+
woofs
257+
}
258+
... on Cat {
259+
meows
260+
}
257261
}
258262
}
259-
}`;
263+
`;
260264

261265
const result = graphqlSync(schema, query);
262266

@@ -278,7 +282,7 @@ describe('Execute: Handles execution of abstract types', () => {
278282
{
279283
message:
280284
'Runtime Object type "Human" is not a possible type for "Pet".',
281-
locations: [{ line: 2, column: 7 }],
285+
locations: [{ line: 3, column: 9 }],
282286
path: ['pets', 2],
283287
},
284288
],
@@ -341,18 +345,20 @@ describe('Execute: Handles execution of abstract types', () => {
341345
}),
342346
});
343347

344-
const query = `{
345-
pets {
346-
... on Dog {
347-
name
348-
woofs
349-
}
350-
... on Cat {
351-
name
352-
meows
348+
const query = `
349+
{
350+
pets {
351+
... on Dog {
352+
name
353+
woofs
354+
}
355+
... on Cat {
356+
name
357+
meows
358+
}
353359
}
354360
}
355-
}`;
361+
`;
356362

357363
const result = graphqlSync(schema, query);
358364

@@ -374,7 +380,7 @@ describe('Execute: Handles execution of abstract types', () => {
374380
{
375381
message:
376382
'Runtime Object type "Human" is not a possible type for "Pet".',
377-
locations: [{ line: 2, column: 7 }],
383+
locations: [{ line: 3, column: 9 }],
378384
path: ['pets', 2],
379385
},
380386
],
@@ -469,17 +475,19 @@ describe('Execute: Handles execution of abstract types', () => {
469475
types: [CatType, DogType],
470476
});
471477

472-
const query = `{
473-
pets {
474-
name
475-
... on Dog {
476-
woofs
477-
}
478-
... on Cat {
479-
meows
478+
const query = `
479+
{
480+
pets {
481+
name
482+
... on Dog {
483+
woofs
484+
}
485+
... on Cat {
486+
meows
487+
}
480488
}
481489
}
482-
}`;
490+
`;
483491

484492
const result = graphqlSync(schema, query);
485493

0 commit comments

Comments
 (0)