@@ -11,7 +11,6 @@ import graphql.language.NullValue
1111import graphql.language.ObjectField
1212import graphql.language.ObjectValue
1313import graphql.language.StringValue
14- import graphql.language.Type
1514import graphql.language.TypeName
1615import graphql.schema.idl.TypeUtil
1716import spock.lang.Specification
@@ -89,6 +88,18 @@ class ValueToVariableValueCompilerTest extends Specification {
8988 // but for now this is what we do
9089 }
9190
91+ def " can handle NormalizedInputValue values that are NIV with null members" () {
92+ expect :
93+ def niv = new NormalizedInputValue (" TypeName" , value)
94+ def actual = ValueToVariableValueCompiler . normalisedValueToVariableValue(niv)
95+ actual == expected
96+
97+ where :
98+ value | expected
99+ [a : new NormalizedInputValue (" X" , IntValue . of(666 )), b : new NormalizedInputValue (" X" , null )] | [a : 666 , b : null ]
100+ [new NormalizedInputValue (" X" , IntValue . of(666 )), new NormalizedInputValue (" X" , null )] | [666 , null ]
101+ }
102+
92103
93104 def " can print variables as expected" () {
94105 expect :
@@ -100,7 +111,7 @@ class ValueToVariableValueCompilerTest extends Specification {
100111 // compare actual type
101112 def actualType = actual. definition. type
102113 actualType. isEqualTo(expectedType)
103- if (actualType instanceof NonNullType || actualType instanceof ListType ){
114+ if (actualType instanceof NonNullType || actualType instanceof ListType ) {
104115 actualType. type. isEqualTo(expectedType. type)
105116 }
106117 TypeUtil . simplePrint(actualType) == typeName
@@ -113,8 +124,8 @@ class ValueToVariableValueCompilerTest extends Specification {
113124 BooleanValue . of(true ) | 4 | " Boolean!" | true | " v4" | new NonNullType (new TypeName (" Boolean" ))
114125 FloatValue . of(999d ) | 5 | " Float" | 999d | " v5" | new TypeName (" Float" )
115126 EnumValue . of(" enumValue" ) | 6 | " Foo!" | " enumValue" | " v6" | new NonNullType (new TypeName (" Foo" ))
116- [" a" : IntValue . of(64 ),
117- " b" :IntValue . of(65 ) ] | 7 | " ObjectType" | [a : 64 , b : 65 ] | " v7" | new TypeName (" ObjectType" )
127+ [" a" : IntValue . of(64 ),
128+ " b" : IntValue . of(65 )] | 7 | " ObjectType" | [a : 64 , b : 65 ] | " v7" | new TypeName (" ObjectType" )
118129 [StringValue . of(" 9" ),
119130 StringValue . of(" 10" ),
120131 StringValue . of(" 11" )] | 8 | " [String]" | [" 9" , " 10" , " 11" ] | " v8" | new ListType ((new TypeName (" String" )))
0 commit comments