From 8cf2707faa9e73522d902e80956553c70fb71104 Mon Sep 17 00:00:00 2001 From: Jacob Haslehurst Date: Mon, 20 Nov 2017 11:44:11 +1100 Subject: [PATCH] add failing test for list of non-null items for issue #84 --- juniper/src/executor_tests/executor.rs | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/juniper/src/executor_tests/executor.rs b/juniper/src/executor_tests/executor.rs index 3aa35278..13f4fe78 100644 --- a/juniper/src/executor_tests/executor.rs +++ b/juniper/src/executor_tests/executor.rs @@ -451,6 +451,7 @@ mod propagates_errors_to_nullable_fields { graphql_object!(Schema: () |&self| { field inner() -> Inner { Inner } + field inners() -> Vec { (0..5).map(|_| Inner).collect() } }); graphql_object!(Inner: () |&self| { @@ -589,6 +590,32 @@ mod propagates_errors_to_nullable_fields { ), ]); } + + #[test] + fn non_null_list() { + let schema = RootNode::new(Schema, EmptyMutation::<()>::new()); + let doc = r"{ inners { nonNullableErrorField } }"; + + let vars = vec![].into_iter().collect(); + + let (result, errs) = ::execute(doc, None, &schema, &vars, &()).expect("Execution failed"); + + println!("Result: {:?}", result); + + assert_eq!( + result, + graphql_value!(None)); + + assert_eq!( + errs, + vec![ + ExecutionError::new( + SourcePosition::new(10, 0, 10), + &["inner", "nonNullableErrorField"], + FieldError::new("Error for nonNullableErrorField", Value::null()), + ), + ]); + } } mod named_operations {