1
1
import { expect } from 'chai' ;
2
2
import { describe , it } from 'mocha' ;
3
+
4
+ import { GraphQLError } from '../../error/GraphQLError' ;
5
+
6
+ import type { ExecutableDefinitionNode , FieldNode } from '../../language/ast' ;
3
7
import { parse } from '../../language/parser' ;
8
+
4
9
import { GraphQLNonNull , GraphQLObjectType , GraphQLSemanticNonNull , GraphQLSemanticNullable } from '../../type/definition' ;
5
- import { execute } from '../execute' ;
6
- import { GraphQLSchema } from '../../type/schema' ;
7
10
import { GraphQLString } from '../../type/scalars' ;
8
- import { ExecutableDefinitionNode , FieldNode } from '../../language' ;
9
- import { GraphQLError } from '../../error/GraphQLError' ;
11
+ import { GraphQLSchema } from '../../type/schema' ;
12
+
13
+ import { execute } from '../execute' ;
10
14
11
15
describe ( 'Execute: Handles Semantic Nullability' , ( ) => {
12
16
const DeepDataType = new GraphQLObjectType ( {
@@ -45,8 +49,8 @@ describe('Execute: Handles Semantic Nullability', () => {
45
49
rootValue : data ,
46
50
} ) ;
47
51
48
- let executable = document . definitions ?. values ( ) . next ( ) . value as ExecutableDefinitionNode ;
49
- let selectionSet = executable . selectionSet . selections . values ( ) . next ( ) . value ;
52
+ const executable = document . definitions ?. values ( ) . next ( ) . value as ExecutableDefinitionNode ;
53
+ const selectionSet = executable . selectionSet . selections . values ( ) . next ( ) . value ;
50
54
51
55
expect ( result ) . to . deep . equal ( {
52
56
data : {
@@ -68,7 +72,7 @@ describe('Execute: Handles Semantic Nullability', () => {
68
72
const data = {
69
73
a : ( ) => 'Apple' ,
70
74
b : ( ) => { throw new Error (
71
- ` Something went wrong` ,
75
+ ' Something went wrong' ,
72
76
) ; } ,
73
77
c : ( ) => 'Cookie'
74
78
} ;
@@ -79,8 +83,8 @@ describe('Execute: Handles Semantic Nullability', () => {
79
83
}
80
84
` ) ;
81
85
82
- let executable = document . definitions ?. values ( ) . next ( ) . value as ExecutableDefinitionNode ;
83
- let selectionSet = executable . selectionSet . selections . values ( ) . next ( ) . value ;
86
+ const executable = document . definitions ?. values ( ) . next ( ) . value as ExecutableDefinitionNode ;
87
+ const selectionSet = executable . selectionSet . selections . values ( ) . next ( ) . value ;
84
88
85
89
const result = await execute ( {
86
90
schema : new GraphQLSchema ( { query : DataType } ) ,
@@ -131,9 +135,9 @@ describe('Execute: Handles Semantic Nullability', () => {
131
135
rootValue : data ,
132
136
} ) ;
133
137
134
- let executable = document . definitions ?. values ( ) . next ( ) . value as ExecutableDefinitionNode ;
135
- let dSelectionSet = executable . selectionSet . selections . values ( ) . next ( ) . value as FieldNode ;
136
- let fSelectionSet = dSelectionSet . selectionSet ?. selections . values ( ) . next ( ) . value ;
138
+ const executable = document . definitions ?. values ( ) . next ( ) . value as ExecutableDefinitionNode ;
139
+ const dSelectionSet = executable . selectionSet . selections . values ( ) . next ( ) . value as FieldNode ;
140
+ const fSelectionSet = dSelectionSet . selectionSet ?. selections . values ( ) . next ( ) . value ;
137
141
138
142
expect ( result ) . to . deep . equal ( {
139
143
data : {
0 commit comments