@@ -36,9 +36,7 @@ describe('Execute: Handles Semantic Nullability', () => {
3636
3737 it ( 'SemanticNonNull throws error on null without error' , async ( ) => {
3838 const data = {
39- a : ( ) => 'Apple' ,
4039 b : ( ) => null ,
41- c : ( ) => 'Cookie' ,
4240 } ;
4341
4442 const document = parse ( `
@@ -53,11 +51,8 @@ describe('Execute: Handles Semantic Nullability', () => {
5351 rootValue : data ,
5452 } ) ;
5553
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 ] ;
6156
6257 expect ( result ) . to . deep . equal ( {
6358 data : {
@@ -77,11 +72,9 @@ describe('Execute: Handles Semantic Nullability', () => {
7772
7873 it ( 'SemanticNonNull succeeds on null with error' , async ( ) => {
7974 const data = {
80- a : ( ) => 'Apple' ,
8175 b : ( ) => {
8276 throw new Error ( 'Something went wrong' ) ;
8377 } ,
84- c : ( ) => 'Cookie' ,
8578 } ;
8679
8780 const document = parse ( `
@@ -90,11 +83,8 @@ describe('Execute: Handles Semantic Nullability', () => {
9083 }
9184 ` ) ;
9285
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 ] ;
9888
9989 const result = await execute ( {
10090 schema : new GraphQLSchema ( { query : DataType } ) ,
@@ -121,9 +111,6 @@ describe('Execute: Handles Semantic Nullability', () => {
121111 } ;
122112
123113 const data = {
124- a : ( ) => 'Apple' ,
125- b : ( ) => null ,
126- c : ( ) => 'Cookie' ,
127114 d : ( ) => deepData ,
128115 } ;
129116
@@ -141,13 +128,9 @@ describe('Execute: Handles Semantic Nullability', () => {
141128 rootValue : data ,
142129 } ) ;
143130
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 ] ;
151134
152135 expect ( result ) . to . deep . equal ( {
153136 data : {
0 commit comments