Skip to content

Commit 4a4d5ac

Browse files
committed
Add a test if part (E) of fields_will_merge is commented out
1 parent f6ad46e commit 4a4d5ac

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

spec/graphql/static_validation/rules/fields_will_merge_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,38 @@
579579
end
580580
end
581581

582+
describe "nested spreads on the same type with a conflict" do
583+
let(:query_string) {%|
584+
{
585+
dog {
586+
name
587+
...D
588+
}
589+
}
590+
591+
fragment D on Dog {
592+
...D2
593+
}
594+
595+
fragment D2 on Dog {
596+
name: __typename
597+
}
598+
|}
599+
600+
it "finds a conflict" do
601+
assert_equal [
602+
{"message"=>"Field 'name' has a field conflict: name or __typename?",
603+
"locations"=>[{"line"=>4, "column"=>11}, {"line"=>14, "column"=>9}],
604+
"path"=>[],
605+
"extensions"=>
606+
{"code"=>"fieldConflict",
607+
"fieldName"=>"name",
608+
"conflicts"=>"name or __typename"}
609+
}
610+
], errors
611+
end
612+
end
613+
582614
describe "same aliases not allowed on different interfaces" do
583615
let(:query_string) {%|
584616
{

0 commit comments

Comments
 (0)