spec/integration/rails/graphql/relay/connection_instrumentation_spec.rb in graphql-1.8.18 vs spec/integration/rails/graphql/relay/connection_instrumentation_spec.rb in graphql-1.9.0.pre1
- old
+ new
@@ -9,15 +9,10 @@
end
assert_equal ["tests"], test_type.fields.keys
end
- it "keeps a reference to the function" do
- conn_field = StarWars::Faction.graphql_definition.fields["shipsWithMaxPageSize"]
- assert_instance_of StarWars::ShipsWithMaxPageSize, conn_field.function
- end
-
let(:build_schema) {
test_type = nil
test_field = GraphQL::Field.define do
type(test_type.connection_type)
@@ -56,28 +51,30 @@
assert_instance_of GraphQL::Relay::ConnectionResolve, connection_field.resolve_proc
assert_instance_of GraphQL::Relay::ConnectionResolve, redefined_connection_field.resolve_proc
end
- describe "after_built_ins instrumentation" do
- it "has access to connection objects" do
- query_str = <<-GRAPHQL
- {
- rebels {
- ships {
- pageInfo {
- __typename
+ # field instrumentation doesn't exist here
+ if !TESTING_INTERPRETER
+ describe "after_built_ins instrumentation" do
+ it "has access to connection objects" do
+ query_str = <<-GRAPHQL
+ {
+ rebels {
+ ships {
+ pageInfo {
+ __typename
+ }
}
}
}
- }
- GRAPHQL
- ctx = { before_built_ins: [], after_built_ins: [] }
- star_wars_query(query_str, {}, context: ctx)
- # The second item is different here:
- # Before the object is wrapped in a connection, the instrumentation sees `Array`
- assert_equal ["StarWars::FactionRecord", "Array", "GraphQL::Relay::ArrayConnection"], ctx[:before_built_ins]
- # After the object is wrapped in a connection, it sees the connection object
- assert_equal ["StarWars::Faction", "StarWars::ShipConnectionWithParentType", "GraphQL::Types::Relay::PageInfo"], ctx[:after_built_ins]
+ GRAPHQL
+ ctx = { before_built_ins: [], after_built_ins: [] }
+ star_wars_query(query_str, {}, context: ctx)
+ # These are data classes, later they're wrapped with type proxies
+ assert_equal ["StarWars::FactionRecord", "GraphQL::Relay::ArrayConnection", "GraphQL::Relay::ArrayConnection"], ctx[:before_built_ins]
+ # After the object is wrapped in a connection, it sees the connection object
+ assert_equal ["StarWars::Faction", "StarWars::ShipConnectionWithParentType", "GraphQL::Types::Relay::PageInfo"], ctx[:after_built_ins]
+ end
end
end
end