@@ -14,6 +14,8 @@ import graphql.util.TraverserContext
1414import graphql.util.TraverserVisitorStub
1515import spock.lang.Specification
1616
17+ import static graphql.language.AstPrinter.printAst
18+ import static graphql.parser.Parser.parseValue
1719import static graphql.schema.FieldCoordinates.coordinates
1820
1921class NormalizedQueryTreeFactoryTest extends Specification {
@@ -1091,7 +1093,7 @@ schema {
10911093 var2 : [foo : " foo" , input2 : [bar : 123 ]]
10921094 ]
10931095 // the normalized arg value should be the same regardless of how the value was provided
1094- def expectedNormalizedArgValue = [foo : new NormalizedInputValue (" String" , " foo" ) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , 123 )])]
1096+ def expectedNormalizedArgValue = [foo : new NormalizedInputValue (" String" , parseValue( ' "foo"' )) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , parseValue( " 123" ) )])]
10951097 when :
10961098 def tree = dependencyGraph. createNormalizedQueryWithRawVariables(graphQLSchema, document, null , variables)
10971099 def topLevelField = tree. getTopLevelFields(). get(0 )
@@ -1102,7 +1104,7 @@ schema {
11021104
11031105 then :
11041106 topLevelField. getNormalizedArgument(" id" ). getTypeName() == " ID"
1105- topLevelField. getNormalizedArgument(" id" ). getValue() == " 123"
1107+ printAst( topLevelField. getNormalizedArgument(" id" ). getValue()) == ' "123"'
11061108
11071109 arg1. getTypeName() == " Input1"
11081110 arg1. getValue() == expectedNormalizedArgValue
@@ -1151,16 +1153,16 @@ schema {
11511153
11521154 then :
11531155 arg1. typeName == " [ID!]"
1154- arg1. value == [" 1" , " 2" ]
1156+ arg1. value. collect { printAst(it) } == [' "1"' , ' "2"' ]
11551157 arg2. typeName == " [[Input1]]"
11561158 arg2. value == [[
1157- [foo : new NormalizedInputValue (" String" , " foo1" ) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , 123 )])],
1158- [foo : new NormalizedInputValue (" String" , " foo2" ) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , 456 )])]
1159+ [foo : new NormalizedInputValue (" String" , parseValue( ' "foo1"' )) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , parseValue( " 123" ) )])],
1160+ [foo : new NormalizedInputValue (" String" , parseValue( ' "foo2"' )) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , parseValue( " 456" ) )])]
11591161 ]]
11601162
11611163 arg3. getTypeName() == " [Input1]"
11621164 arg3. value == [
1163- [foo : new NormalizedInputValue (" String" , " foo3" ) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , 789 )])],
1165+ [foo : new NormalizedInputValue (" String" , parseValue( ' "foo3"' )) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , parseValue( " 789" ) )])],
11641166 ]
11651167
11661168
@@ -1204,10 +1206,10 @@ schema {
12041206 then :
12051207 arg1. typeName == " [[Input1]]"
12061208 arg1. value == [[
1207- [foo : new NormalizedInputValue (" String" , " foo1" ) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , 123 )])],
1209+ [foo : new NormalizedInputValue (" String" , parseValue( ' "foo1"' )) , input2 : new NormalizedInputValue (" Input2" , [bar : new NormalizedInputValue (" Int" , parseValue( " 123" ) )])],
12081210 ]]
12091211 arg2. typeName == " [[ID!]!]"
1210- arg2. value == [[" 1" ], [" 2" ]]
1212+ arg2. value. collect { outer -> outer . collect { printAst(it) } } == [[' "1"' ], [' "2"' ]]
12111213 }
12121214
12131215}
0 commit comments