@@ -8,71 +8,30 @@ class ExecutionInputValuesTest < Minitest::Test
88 INACTIVE
99 }
1010
11- input NestedInput {
12- value: String
13- nested: NestedInput
14- }
15-
1611 input TestInput {
1712 string: String
18- int: Int
1913 float: Float
20- boolean: Boolean
21- id: ID
22- enum: TestStatus
23- nested: NestedInput
24- stringList: [String]
25- nonNullItemList: [String!]
26- nestedList: [NestedInput]
27- }
28-
29- input RequiredFieldsInput {
30- required: String!
31- optional: String
32- }
33-
34- input ValidatedFieldsInput {
35- scalar: String
36- list: [String]
37- input: ValidatedFieldsInput
38- inputList: [ValidatedFieldsInput]
39- }
40-
41- input OneOfInput @oneOf {
42- string: String
4314 int: Int
15+ enum: TestStatus
4416 }
4517
4618 type Mutation {
4719 testInput(input: TestInput): Boolean
48- requiredFields(input: RequiredFieldsInput!): Boolean
49- argWithDefault(input: String = "fallback-value"): Boolean
50- oneOf(input: OneOfInput!): Boolean
51- validates(input: ValidatedFieldsInput!): Boolean
52- validatesOneArg(a: String, b: String): Boolean
5320 }
5421
5522 type Query {
5623 ping: Boolean
5724 }
5825 | )
5926
60- TEST_SCHEMA . mutation . fields [ "validatesOneArg" ] . tap do |f |
61- f . validates ( required : { one_of : [ :a , :b ] } )
62- end
63-
64- TEST_SCHEMA . get_type ( "ValidatedFieldsInput" ) . tap do |t |
65- t . arguments [ "scalar" ] . validates ( length : { minimum : 2 } )
66- t . arguments [ "list" ] . validates ( length : { minimum : 2 } )
67- end
6827
6928 class DummyRunner
7029 def add_step ( s ) ; end
7130 def schema ; TEST_SCHEMA ; end
7231 end
7332
7433 def get_input_values ( variables_string : "" , variables : nil )
75- query_str = "query(#{ variables_string } ) { __typename }"
34+ query_str = "query#{ variables_string ? " (#{ variables_string } )" : "" } { __typename }"
7635 query = GraphQL ::Query . new ( TEST_SCHEMA , query_str , validate : false , variables : variables )
7736 GraphQL ::Execution ::InputValues . new ( query , DummyRunner . new )
7837 end
0 commit comments