Skip to content

Commit 5659a69

Browse files
committed
Test querying meta fields for mismatching types
1 parent 1e9c63e commit 5659a69

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/executor_tests/introspection.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ fn enum_introspection() {
9191
isDeprecated
9292
deprecationReason
9393
}
94+
interfaces { name }
95+
possibleTypes { name }
96+
inputFields { name }
97+
ofType { name }
9498
}
9599
}
96100
"#;
@@ -111,6 +115,10 @@ fn enum_introspection() {
111115
assert_eq!(type_info.get("name"), Some(&Value::string("SampleEnum")));
112116
assert_eq!(type_info.get("kind"), Some(&Value::string("ENUM")));
113117
assert_eq!(type_info.get("description"), Some(&Value::null()));
118+
assert_eq!(type_info.get("interfaces"), Some(&Value::null()));
119+
assert_eq!(type_info.get("possibleTypes"), Some(&Value::null()));
120+
assert_eq!(type_info.get("inputFields"), Some(&Value::null()));
121+
assert_eq!(type_info.get("ofType"), Some(&Value::null()));
114122

115123
let values = type_info
116124
.get("enumValues").expect("enumValues field missing")
@@ -161,6 +169,10 @@ fn interface_introspection() {
161169
isDeprecated
162170
deprecationReason
163171
}
172+
interfaces { name }
173+
enumValues { name }
174+
inputFields { name }
175+
ofType { name }
164176
}
165177
}
166178
"#;
@@ -180,7 +192,11 @@ fn interface_introspection() {
180192

181193
assert_eq!(type_info.get("name"), Some(&Value::string("SampleInterface")));
182194
assert_eq!(type_info.get("kind"), Some(&Value::string("INTERFACE")));
183-
assert_eq!(type_info.get("description"), Some(&Value::string("A sample interface")));
195+
assert_eq!(type_info.get("description"), Some(&Value::string("A sample interface")));
196+
assert_eq!(type_info.get("interfaces"), Some(&Value::null()));
197+
assert_eq!(type_info.get("enumValues"), Some(&Value::null()));
198+
assert_eq!(type_info.get("inputFields"), Some(&Value::null()));
199+
assert_eq!(type_info.get("ofType"), Some(&Value::null()));
184200

185201
let possible_types = type_info
186202
.get("possibleTypes").expect("possibleTypes field missing")
@@ -223,6 +239,12 @@ fn scalar_introspection() {
223239
name
224240
kind
225241
description
242+
fields { name }
243+
interfaces { name }
244+
possibleTypes { name }
245+
enumValues { name }
246+
inputFields { name }
247+
ofType { name }
226248
}
227249
}
228250
"#;
@@ -243,5 +265,11 @@ fn scalar_introspection() {
243265
("name", Value::string("SampleScalar")),
244266
("kind", Value::string("SCALAR")),
245267
("description", Value::null()),
268+
("fields", Value::null()),
269+
("interfaces", Value::null()),
270+
("possibleTypes", Value::null()),
271+
("enumValues", Value::null()),
272+
("inputFields", Value::null()),
273+
("ofType", Value::null()),
246274
].into_iter().collect()));
247275
}

0 commit comments

Comments
 (0)