Skip to content

Commit 15c9752

Browse files
committed
Add missing spec from rmosolgo#3326
1 parent 1c92184 commit 15c9752

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# frozen_string_literal: true
2+
require "spec_helper"
3+
4+
describe GraphQL::Schema::Field::ConnectionExtension do
5+
class ConnectionShortcutSchema < GraphQL::Schema
6+
class ShortcutResolveExtension < GraphQL::Schema::FieldExtension
7+
def resolve(**rest)
8+
["a", "b", "c", "d", "e"]
9+
end
10+
end
11+
class Query < GraphQL::Schema::Object
12+
field :names, GraphQL::Types::String.connection_type, null: false, extensions: [ShortcutResolveExtension]
13+
def names
14+
raise "This should never be called"
15+
end
16+
end
17+
18+
query(Query)
19+
end
20+
21+
it "implements connection handling even when resolve is shortcutted" do
22+
res = ConnectionShortcutSchema.execute("{ names(first: 2) { nodes } }")
23+
assert_equal ["a", "b"], res["data"]["names"]["nodes"]
24+
end
25+
end

0 commit comments

Comments
 (0)