Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4107 from rmosolgo/2.0.9-handle-array-prev_type
Fix #add_type for duplicate types with cyclical references
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
require "spec_helper" | ||
|
||
describe GraphQL::Schema::Addition do | ||
it "handles duplicate types with cycles" do | ||
duplicate_types_schema = Class.new(GraphQL::Schema) | ||
duplicate_types = 2.times.map { | ||
Class.new(GraphQL::Schema::Object) do | ||
graphql_name "Thing" | ||
field :thing, self | ||
end | ||
} | ||
duplicate_types_schema.orphan_types(duplicate_types) | ||
assert_equal 2, duplicate_types_schema.send(:own_types)["Thing"].size | ||
end | ||
end |