@@ -41,7 +41,7 @@ describe('Execute: Handles basic execution tasks', () => {
41
41
) . to . throw ( 'Expected undefined to be a GraphQL schema.' ) ;
42
42
} ) ;
43
43
44
- it ( 'accepts an object with named properties as arguments' , async ( ) => {
44
+ it ( 'accepts an object with named properties as arguments' , ( ) => {
45
45
const doc = 'query Example { a }' ;
46
46
47
47
const data = 'rootValue' ;
@@ -60,7 +60,7 @@ describe('Execute: Handles basic execution tasks', () => {
60
60
} ) ,
61
61
} ) ;
62
62
63
- const result = await execute ( {
63
+ const result = execute ( {
64
64
schema,
65
65
document : parse ( doc ) ,
66
66
rootValue : data ,
@@ -215,7 +215,7 @@ describe('Execute: Handles basic execution tasks', () => {
215
215
) . to . deep . equal ( expected ) ;
216
216
} ) ;
217
217
218
- it ( 'merges parallel fragments' , async ( ) => {
218
+ it ( 'merges parallel fragments' , ( ) => {
219
219
const ast = parse ( `
220
220
{ a, ...FragOne, ...FragTwo }
221
221
@@ -241,7 +241,7 @@ describe('Execute: Handles basic execution tasks', () => {
241
241
} ) ;
242
242
const schema = new GraphQLSchema ( { query : Type } ) ;
243
243
244
- expect ( await execute ( schema , ast ) ) . to . deep . equal ( {
244
+ expect ( execute ( schema , ast ) ) . to . deep . equal ( {
245
245
data : {
246
246
a : 'Apple' ,
247
247
b : 'Banana' ,
@@ -258,7 +258,7 @@ describe('Execute: Handles basic execution tasks', () => {
258
258
} ) ;
259
259
} ) ;
260
260
261
- it ( 'provides info about current execution state' , async ( ) => {
261
+ it ( 'provides info about current execution state' , ( ) => {
262
262
const ast = parse ( 'query ($var: String) { result: test }' ) ;
263
263
264
264
let info ;
@@ -279,7 +279,7 @@ describe('Execute: Handles basic execution tasks', () => {
279
279
280
280
const rootValue = { root : 'val' } ;
281
281
282
- await execute ( schema , ast , rootValue , null , { var : 123 } ) ;
282
+ execute ( schema , ast , rootValue , null , { var : 123 } ) ;
283
283
284
284
expect ( Object . keys ( info ) ) . to . deep . equal ( [
285
285
'fieldName' ,
@@ -307,7 +307,7 @@ describe('Execute: Handles basic execution tasks', () => {
307
307
expect ( info . variableValues ) . to . deep . equal ( { var : '123' } ) ;
308
308
} ) ;
309
309
310
- it ( 'threads root value context correctly' , async ( ) => {
310
+ it ( 'threads root value context correctly' , ( ) => {
311
311
const doc = 'query Example { a }' ;
312
312
313
313
const data = {
@@ -330,12 +330,12 @@ describe('Execute: Handles basic execution tasks', () => {
330
330
} ) ,
331
331
} ) ;
332
332
333
- await execute ( schema , parse ( doc ) , data ) ;
333
+ execute ( schema , parse ( doc ) , data ) ;
334
334
335
335
expect ( resolvedRootValue . contextThing ) . to . equal ( 'thing' ) ;
336
336
} ) ;
337
337
338
- it ( 'correctly threads arguments' , async ( ) => {
338
+ it ( 'correctly threads arguments' , ( ) => {
339
339
const doc = `
340
340
query Example {
341
341
b(numArg: 123, stringArg: "foo")
@@ -362,7 +362,7 @@ describe('Execute: Handles basic execution tasks', () => {
362
362
} ) ,
363
363
} ) ;
364
364
365
- await execute ( schema , parse ( doc ) ) ;
365
+ execute ( schema , parse ( doc ) ) ;
366
366
367
367
expect ( resolvedArgs . numArg ) . to . equal ( 123 ) ;
368
368
expect ( resolvedArgs . stringArg ) . to . equal ( 'foo' ) ;
@@ -603,7 +603,7 @@ describe('Execute: Handles basic execution tasks', () => {
603
603
} ) ;
604
604
} ) ;
605
605
606
- it ( 'Full response path is included for non-nullable fields' , async ( ) => {
606
+ it ( 'Full response path is included for non-nullable fields' , ( ) => {
607
607
const A = new GraphQLObjectType ( {
608
608
name : 'A' ,
609
609
fields : ( ) => ( {
@@ -650,7 +650,7 @@ describe('Execute: Handles basic execution tasks', () => {
650
650
}
651
651
` ;
652
652
653
- const result = await execute ( schema , parse ( query ) ) ;
653
+ const result = execute ( schema , parse ( query ) ) ;
654
654
expect ( result ) . to . deep . equal ( {
655
655
data : {
656
656
nullableA : {
@@ -667,7 +667,7 @@ describe('Execute: Handles basic execution tasks', () => {
667
667
} ) ;
668
668
} ) ;
669
669
670
- it ( 'uses the inline operation if no operation name is provided' , async ( ) => {
670
+ it ( 'uses the inline operation if no operation name is provided' , ( ) => {
671
671
const doc = '{ a }' ;
672
672
const data = { a : 'b' } ;
673
673
const ast = parse ( doc ) ;
@@ -680,12 +680,12 @@ describe('Execute: Handles basic execution tasks', () => {
680
680
} ) ,
681
681
} ) ;
682
682
683
- const result = await execute ( schema , ast , data ) ;
683
+ const result = execute ( schema , ast , data ) ;
684
684
685
685
expect ( result ) . to . deep . equal ( { data : { a : 'b' } } ) ;
686
686
} ) ;
687
687
688
- it ( 'uses the only operation if no operation name is provided' , async ( ) => {
688
+ it ( 'uses the only operation if no operation name is provided' , ( ) => {
689
689
const doc = 'query Example { a }' ;
690
690
const data = { a : 'b' } ;
691
691
const ast = parse ( doc ) ;
@@ -698,12 +698,12 @@ describe('Execute: Handles basic execution tasks', () => {
698
698
} ) ,
699
699
} ) ;
700
700
701
- const result = await execute ( schema , ast , data ) ;
701
+ const result = execute ( schema , ast , data ) ;
702
702
703
703
expect ( result ) . to . deep . equal ( { data : { a : 'b' } } ) ;
704
704
} ) ;
705
705
706
- it ( 'uses the named operation if operation name is provided' , async ( ) => {
706
+ it ( 'uses the named operation if operation name is provided' , ( ) => {
707
707
const doc = 'query Example { first: a } query OtherExample { second: a }' ;
708
708
const data = { a : 'b' } ;
709
709
const ast = parse ( doc ) ;
@@ -716,12 +716,12 @@ describe('Execute: Handles basic execution tasks', () => {
716
716
} ) ,
717
717
} ) ;
718
718
719
- const result = await execute ( schema , ast , data , null , null , 'OtherExample' ) ;
719
+ const result = execute ( schema , ast , data , null , null , 'OtherExample' ) ;
720
720
721
721
expect ( result ) . to . deep . equal ( { data : { second : 'b' } } ) ;
722
722
} ) ;
723
723
724
- it ( 'provides error if no operation is provided' , async ( ) => {
724
+ it ( 'provides error if no operation is provided' , ( ) => {
725
725
const doc = 'fragment Example on Type { a }' ;
726
726
const data = { a : 'b' } ;
727
727
const ast = parse ( doc ) ;
@@ -734,13 +734,13 @@ describe('Execute: Handles basic execution tasks', () => {
734
734
} ) ,
735
735
} ) ;
736
736
737
- const result = await execute ( schema , ast , data ) ;
737
+ const result = execute ( schema , ast , data ) ;
738
738
expect ( result ) . to . deep . equal ( {
739
739
errors : [ { message : 'Must provide an operation.' } ] ,
740
740
} ) ;
741
741
} ) ;
742
742
743
- it ( 'errors if no op name is provided with multiple operations' , async ( ) => {
743
+ it ( 'errors if no op name is provided with multiple operations' , ( ) => {
744
744
const doc = 'query Example { a } query OtherExample { a }' ;
745
745
const data = { a : 'b' } ;
746
746
const ast = parse ( doc ) ;
@@ -753,7 +753,7 @@ describe('Execute: Handles basic execution tasks', () => {
753
753
} ) ,
754
754
} ) ;
755
755
756
- const result = await execute ( schema , ast , data ) ;
756
+ const result = execute ( schema , ast , data ) ;
757
757
expect ( result ) . to . deep . equal ( {
758
758
errors : [
759
759
{
@@ -764,7 +764,7 @@ describe('Execute: Handles basic execution tasks', () => {
764
764
} ) ;
765
765
} ) ;
766
766
767
- it ( 'errors if unknown operation name is provided' , async ( ) => {
767
+ it ( 'errors if unknown operation name is provided' , ( ) => {
768
768
const doc = 'query Example { a } query OtherExample { a }' ;
769
769
const ast = parse ( doc ) ;
770
770
const schema = new GraphQLSchema ( {
@@ -776,7 +776,7 @@ describe('Execute: Handles basic execution tasks', () => {
776
776
} ) ,
777
777
} ) ;
778
778
779
- const result = await execute ( {
779
+ const result = execute ( {
780
780
schema,
781
781
document : ast ,
782
782
operationName : 'UnknownExample' ,
@@ -786,7 +786,7 @@ describe('Execute: Handles basic execution tasks', () => {
786
786
} ) ;
787
787
} ) ;
788
788
789
- it ( 'uses the query schema for queries' , async ( ) => {
789
+ it ( 'uses the query schema for queries' , ( ) => {
790
790
const doc = 'query Q { a } mutation M { c } subscription S { a }' ;
791
791
const data = { a : 'b' , c : 'd' } ;
792
792
const ast = parse ( doc ) ;
@@ -811,12 +811,12 @@ describe('Execute: Handles basic execution tasks', () => {
811
811
} ) ,
812
812
} ) ;
813
813
814
- const queryResult = await execute ( schema , ast , data , null , { } , 'Q' ) ;
814
+ const queryResult = execute ( schema , ast , data , null , { } , 'Q' ) ;
815
815
816
816
expect ( queryResult ) . to . deep . equal ( { data : { a : 'b' } } ) ;
817
817
} ) ;
818
818
819
- it ( 'uses the mutation schema for mutations' , async ( ) => {
819
+ it ( 'uses the mutation schema for mutations' , ( ) => {
820
820
const doc = 'query Q { a } mutation M { c }' ;
821
821
const data = { a : 'b' , c : 'd' } ;
822
822
const ast = parse ( doc ) ;
@@ -835,12 +835,12 @@ describe('Execute: Handles basic execution tasks', () => {
835
835
} ) ,
836
836
} ) ;
837
837
838
- const mutationResult = await execute ( schema , ast , data , null , { } , 'M' ) ;
838
+ const mutationResult = execute ( schema , ast , data , null , { } , 'M' ) ;
839
839
840
840
expect ( mutationResult ) . to . deep . equal ( { data : { c : 'd' } } ) ;
841
841
} ) ;
842
842
843
- it ( 'uses the subscription schema for subscriptions' , async ( ) => {
843
+ it ( 'uses the subscription schema for subscriptions' , ( ) => {
844
844
const doc = 'query Q { a } subscription S { a }' ;
845
845
const data = { a : 'b' , c : 'd' } ;
846
846
const ast = parse ( doc ) ;
@@ -859,7 +859,7 @@ describe('Execute: Handles basic execution tasks', () => {
859
859
} ) ,
860
860
} ) ;
861
861
862
- const subscriptionResult = await execute ( schema , ast , data , null , { } , 'S' ) ;
862
+ const subscriptionResult = execute ( schema , ast , data , null , { } , 'S' ) ;
863
863
864
864
expect ( subscriptionResult ) . to . deep . equal ( { data : { a : 'b' } } ) ;
865
865
} ) ;
@@ -920,7 +920,7 @@ describe('Execute: Handles basic execution tasks', () => {
920
920
expect ( Object . keys ( result . data ) ) . to . deep . equal ( [ 'a' , 'b' , 'c' , 'd' , 'e' ] ) ;
921
921
} ) ;
922
922
923
- it ( 'Avoids recursion' , async ( ) => {
923
+ it ( 'Avoids recursion' , ( ) => {
924
924
const doc = `
925
925
query Q {
926
926
a
@@ -944,12 +944,12 @@ describe('Execute: Handles basic execution tasks', () => {
944
944
} ) ,
945
945
} ) ;
946
946
947
- const queryResult = await execute ( schema , ast , data , null , { } , 'Q' ) ;
947
+ const queryResult = execute ( schema , ast , data , null , { } , 'Q' ) ;
948
948
949
949
expect ( queryResult ) . to . deep . equal ( { data : { a : 'b' } } ) ;
950
950
} ) ;
951
951
952
- it ( 'does not include illegal fields in output' , async ( ) => {
952
+ it ( 'does not include illegal fields in output' , ( ) => {
953
953
const doc = `mutation M {
954
954
thisIsIllegalDontIncludeMe
955
955
}` ;
@@ -969,14 +969,14 @@ describe('Execute: Handles basic execution tasks', () => {
969
969
} ) ,
970
970
} ) ;
971
971
972
- const mutationResult = await execute ( schema , ast ) ;
972
+ const mutationResult = execute ( schema , ast ) ;
973
973
974
974
expect ( mutationResult ) . to . deep . equal ( {
975
975
data : { } ,
976
976
} ) ;
977
977
} ) ;
978
978
979
- it ( 'does not include arguments that were not set' , async ( ) => {
979
+ it ( 'does not include arguments that were not set' , ( ) => {
980
980
const schema = new GraphQLSchema ( {
981
981
query : new GraphQLObjectType ( {
982
982
name : 'Type' ,
@@ -997,7 +997,7 @@ describe('Execute: Handles basic execution tasks', () => {
997
997
} ) ;
998
998
999
999
const query = parse ( '{ field(a: true, c: false, e: 0) }' ) ;
1000
- const result = await execute ( schema , query ) ;
1000
+ const result = execute ( schema , query ) ;
1001
1001
1002
1002
expect ( result ) . to . deep . equal ( {
1003
1003
data : {
@@ -1006,7 +1006,7 @@ describe('Execute: Handles basic execution tasks', () => {
1006
1006
} ) ;
1007
1007
} ) ;
1008
1008
1009
- it ( 'fails when an isTypeOf check is not met' , async ( ) => {
1009
+ it ( 'fails when an isTypeOf check is not met' , ( ) => {
1010
1010
class Special {
1011
1011
constructor ( value ) {
1012
1012
this . value = value ;
@@ -1045,7 +1045,7 @@ describe('Execute: Handles basic execution tasks', () => {
1045
1045
const value = {
1046
1046
specials : [ new Special ( 'foo' ) , new NotSpecial ( 'bar' ) ] ,
1047
1047
} ;
1048
- const result = await execute ( schema , query , value ) ;
1048
+ const result = execute ( schema , query , value ) ;
1049
1049
1050
1050
expect ( result ) . to . deep . equal ( {
1051
1051
data : {
@@ -1062,7 +1062,7 @@ describe('Execute: Handles basic execution tasks', () => {
1062
1062
} ) ;
1063
1063
} ) ;
1064
1064
1065
- it ( 'executes ignoring invalid non-executable definitions' , async ( ) => {
1065
+ it ( 'executes ignoring invalid non-executable definitions' , ( ) => {
1066
1066
const query = parse ( `
1067
1067
{ foo }
1068
1068
@@ -1078,16 +1078,16 @@ describe('Execute: Handles basic execution tasks', () => {
1078
1078
} ) ,
1079
1079
} ) ;
1080
1080
1081
- const result = await execute ( schema , query ) ;
1081
+ const result = execute ( schema , query ) ;
1082
1082
expect ( result ) . to . deep . equal ( {
1083
1083
data : {
1084
1084
foo : null ,
1085
1085
} ,
1086
1086
} ) ;
1087
1087
} ) ;
1088
1088
1089
- it ( 'uses a custom field resolver' , async ( ) => {
1090
- const query = parse ( '{ foo }' ) ;
1089
+ it ( 'uses a custom field resolver' , ( ) => {
1090
+ const document = parse ( '{ foo }' ) ;
1091
1091
1092
1092
const schema = new GraphQLSchema ( {
1093
1093
query : new GraphQLObjectType ( {
@@ -1103,15 +1103,7 @@ describe('Execute: Handles basic execution tasks', () => {
1103
1103
return info . fieldName ;
1104
1104
}
1105
1105
1106
- const result = await execute (
1107
- schema ,
1108
- query ,
1109
- null ,
1110
- null ,
1111
- null ,
1112
- null ,
1113
- customResolver ,
1114
- ) ;
1106
+ const result = execute ( { schema, document, fieldResolver : customResolver } ) ;
1115
1107
1116
1108
expect ( result ) . to . deep . equal ( { data : { foo : 'foo' } } ) ;
1117
1109
} ) ;
0 commit comments