@@ -36,9 +36,7 @@ describe('Execute: Handles Semantic Nullability', () => {
36
36
37
37
it ( 'SemanticNonNull throws error on null without error' , async ( ) => {
38
38
const data = {
39
- a : ( ) => 'Apple' ,
40
39
b : ( ) => null ,
41
- c : ( ) => 'Cookie' ,
42
40
} ;
43
41
44
42
const document = parse ( `
@@ -53,11 +51,8 @@ describe('Execute: Handles Semantic Nullability', () => {
53
51
rootValue : data ,
54
52
} ) ;
55
53
56
- const executable = document . definitions ?. values ( ) . next ( )
57
- . value as ExecutableDefinitionNode ;
58
- const selectionSet = executable . selectionSet . selections
59
- . values ( )
60
- . next ( ) . value ;
54
+ const executable = document . definitions [ 0 ] as ExecutableDefinitionNode ;
55
+ const selectionSet = executable . selectionSet . selections [ 0 ] ;
61
56
62
57
expect ( result ) . to . deep . equal ( {
63
58
data : {
@@ -77,11 +72,9 @@ describe('Execute: Handles Semantic Nullability', () => {
77
72
78
73
it ( 'SemanticNonNull succeeds on null with error' , async ( ) => {
79
74
const data = {
80
- a : ( ) => 'Apple' ,
81
75
b : ( ) => {
82
76
throw new Error ( 'Something went wrong' ) ;
83
77
} ,
84
- c : ( ) => 'Cookie' ,
85
78
} ;
86
79
87
80
const document = parse ( `
@@ -90,11 +83,8 @@ describe('Execute: Handles Semantic Nullability', () => {
90
83
}
91
84
` ) ;
92
85
93
- const executable = document . definitions ?. values ( ) . next ( )
94
- . value as ExecutableDefinitionNode ;
95
- const selectionSet = executable . selectionSet . selections
96
- . values ( )
97
- . next ( ) . value ;
86
+ const executable = document . definitions [ 0 ] as ExecutableDefinitionNode ;
87
+ const selectionSet = executable . selectionSet . selections [ 0 ] ;
98
88
99
89
const result = await execute ( {
100
90
schema : new GraphQLSchema ( { query : DataType } ) ,
@@ -121,9 +111,6 @@ describe('Execute: Handles Semantic Nullability', () => {
121
111
} ;
122
112
123
113
const data = {
124
- a : ( ) => 'Apple' ,
125
- b : ( ) => null ,
126
- c : ( ) => 'Cookie' ,
127
114
d : ( ) => deepData ,
128
115
} ;
129
116
@@ -141,13 +128,9 @@ describe('Execute: Handles Semantic Nullability', () => {
141
128
rootValue : data ,
142
129
} ) ;
143
130
144
- const executable = document . definitions ?. values ( ) . next ( )
145
- . value as ExecutableDefinitionNode ;
146
- const dSelectionSet = executable . selectionSet . selections . values ( ) . next ( )
147
- . value as FieldNode ;
148
- const fSelectionSet = dSelectionSet . selectionSet ?. selections
149
- . values ( )
150
- . next ( ) . value ;
131
+ const executable = document . definitions [ 0 ] as ExecutableDefinitionNode ;
132
+ const dSelectionSet = executable . selectionSet . selections [ 0 ] as FieldNode ;
133
+ const fSelectionSet = dSelectionSet . selectionSet ?. selections [ 0 ] ;
151
134
152
135
expect ( result ) . to . deep . equal ( {
153
136
data : {
0 commit comments