forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Issue743.groovy
33 lines (26 loc) · 991 Bytes
/
Issue743.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package graphql
import spock.lang.Specification
class Issue743 extends Specification {
def "#743 missing variables"() {
when:
def graphQL = TestUtil.graphQL("""
type Query {
version : Int
}
""").build()
def executionInput = ExecutionInput.newExecutionInput()
.query('''
query NPEDueToMissingVariable($isTrue: Boolean!) {
version @include(if: $isTrue)
}
''')
.variables([:])
.build()
def executionResult = graphQL.execute(executionInput)
then:
executionResult.data == null
executionResult.errors.size() == 1
executionResult.errors[0].errorType == ErrorType.ValidationError
executionResult.errors[0].message == "Variable 'isTrue' has invalid value: Variable 'isTrue' has coerced Null value for NonNull type 'Boolean!'"
}
}