Skip to content

Commit 459bc71

Browse files
committed
Add schema.execute test, too
1 parent d33bfbd commit 459bc71

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/graphql/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ def possible_types(type = nil, context = GraphQL::Query::NullContext)
11171117
next true unless type.kind.interface?
11181118
next true unless possible_type.kind.object?
11191119

1120-
# Use `.graphql_name` comparison to match legacy vs class-based types.
1120+
# Use `.graphql_name` comparison to match legacy vs class-based types.
11211121
# When we don't need to support legacy `.define` types, use `.include?(type)` instead.
11221122
possible_type.interfaces(context).any? { |interface| interface.graphql_name == type.graphql_name }
11231123
end if stored_possible_types

spec/graphql/analysis/ast/max_query_depth_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@
145145

146146
it "returns an error" do
147147
assert_equal ["This query is too large to execute."], query.result["errors"].map { |err| err["message"] }
148+
149+
# Make sure `Schema.execute` works too
150+
execute_result = schema.execute(query_string)
151+
assert_equal ["This query is too large to execute."], execute_result["errors"].map { |err| err["message"] }
148152
end
149153
end
150154
end

0 commit comments

Comments
 (0)