From 5659a696f16b3d99a79dc800a644fcf6340b42c7 Mon Sep 17 00:00:00 2001 From: Magnus Hallin Date: Wed, 21 Sep 2016 21:54:36 +0200 Subject: [PATCH] Test querying meta fields for mismatching types --- src/executor_tests/introspection.rs | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/executor_tests/introspection.rs b/src/executor_tests/introspection.rs index b1355ba6..c96d7602 100644 --- a/src/executor_tests/introspection.rs +++ b/src/executor_tests/introspection.rs @@ -91,6 +91,10 @@ fn enum_introspection() { isDeprecated deprecationReason } + interfaces { name } + possibleTypes { name } + inputFields { name } + ofType { name } } } "#; @@ -111,6 +115,10 @@ fn enum_introspection() { assert_eq!(type_info.get("name"), Some(&Value::string("SampleEnum"))); assert_eq!(type_info.get("kind"), Some(&Value::string("ENUM"))); assert_eq!(type_info.get("description"), Some(&Value::null())); + assert_eq!(type_info.get("interfaces"), Some(&Value::null())); + assert_eq!(type_info.get("possibleTypes"), Some(&Value::null())); + assert_eq!(type_info.get("inputFields"), Some(&Value::null())); + assert_eq!(type_info.get("ofType"), Some(&Value::null())); let values = type_info .get("enumValues").expect("enumValues field missing") @@ -161,6 +169,10 @@ fn interface_introspection() { isDeprecated deprecationReason } + interfaces { name } + enumValues { name } + inputFields { name } + ofType { name } } } "#; @@ -180,7 +192,11 @@ fn interface_introspection() { assert_eq!(type_info.get("name"), Some(&Value::string("SampleInterface"))); assert_eq!(type_info.get("kind"), Some(&Value::string("INTERFACE"))); - assert_eq!(type_info.get("description"), Some(&Value::string("A sample interface"))); + assert_eq!(type_info.get("description"), Some(&Value::string("A sample interface"))); + assert_eq!(type_info.get("interfaces"), Some(&Value::null())); + assert_eq!(type_info.get("enumValues"), Some(&Value::null())); + assert_eq!(type_info.get("inputFields"), Some(&Value::null())); + assert_eq!(type_info.get("ofType"), Some(&Value::null())); let possible_types = type_info .get("possibleTypes").expect("possibleTypes field missing") @@ -223,6 +239,12 @@ fn scalar_introspection() { name kind description + fields { name } + interfaces { name } + possibleTypes { name } + enumValues { name } + inputFields { name } + ofType { name } } } "#; @@ -243,5 +265,11 @@ fn scalar_introspection() { ("name", Value::string("SampleScalar")), ("kind", Value::string("SCALAR")), ("description", Value::null()), + ("fields", Value::null()), + ("interfaces", Value::null()), + ("possibleTypes", Value::null()), + ("enumValues", Value::null()), + ("inputFields", Value::null()), + ("ofType", Value::null()), ].into_iter().collect())); }