You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/validation/rules/overlapping_fields_can_be_merged.rs
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -941,6 +941,42 @@ fn identical_fields() {
941
941
assert_eq!(get_messages(&errors).len(),0);
942
942
}
943
943
944
+
#[test]
945
+
fnidentical_fields_with_identical_variables(){
946
+
usecrate::validation::test_utils::*;
947
+
948
+
letmut plan = create_plan_from_rule(Box::new(OverlappingFieldsCanBeMerged::new()));
949
+
let errors = test_operation_with_schema(
950
+
r#"fragment mergeIdenticalFieldsWithIdenticalArgs on Dog {
951
+
doesKnowCommand(dogCommand: $dogCommand)
952
+
doesKnowCommand(dogCommand: $dogCommand)
953
+
}"#,
954
+
TEST_SCHEMA,
955
+
&mut plan,
956
+
);
957
+
958
+
assert_eq!(get_messages(&errors).len(),0);
959
+
}
960
+
961
+
#[test]
962
+
fnidentical_fields_with_different_variables(){
963
+
usecrate::validation::test_utils::*;
964
+
965
+
letmut plan = create_plan_from_rule(Box::new(OverlappingFieldsCanBeMerged::new()));
966
+
let errors = test_operation_with_schema(
967
+
r#"fragment mergeIdenticalFieldsWithIdenticalArgs on Dog {
968
+
doesKnowCommand(dogCommand: $catCommand)
969
+
doesKnowCommand(dogCommand: $dogCommand)
970
+
}"#,
971
+
TEST_SCHEMA,
972
+
&mut plan,
973
+
);
974
+
975
+
let messages = get_messages(&errors);
976
+
assert_eq!(messages.len(),1);
977
+
assert_eq!(messages, vec!["Fields \"doesKnowCommand\" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional."]);
0 commit comments