Skip to content

Commit

Permalink
expand supergraph tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmac committed Apr 7, 2024
1 parent b30479d commit 14983f6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/graphql/stitching/supergraph_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ def test_route_type_to_locations_returns_nil_for_unreachable_locations
describe "#to_definition / #from_definition" do
def setup
alpha = %|
type T implements A { id:ID! a:String }
interface A { id:ID! }
type Query { a(id:ID!):A @stitch(key: "id") }
interface I { id:ID! }
type T implements I { id:ID! a:String }
type Query { a(id:ID!):I @stitch(key: "id") }
|
bravo = %|
type T { id:ID! b:String }
Expand All @@ -332,16 +332,16 @@ def test_to_definition_annotates_schema
assert @schema_sdl.include?("directive @resolver")
assert @schema_sdl.include?("directive @source")
assert @schema_sdl.include?(squish_string(%|
interface A @resolver(location: "alpha", key: "id", field: "a", arg: "id") {
interface I @resolver(location: "alpha", key: "id", field: "a", arg: "id") {
|))
assert @schema_sdl.include?(squish_string(%|
type T implements A @resolver(location: "bravo", key: "id", field: "b", arg: "id")
@resolver(typeName: "A", location: "alpha", key: "id", field: "a", arg: "id") {
type T implements I @resolver(location: "bravo", key: "id", field: "b", arg: "id")
@resolver(typeName: "I", location: "alpha", key: "id", field: "a", arg: "id") {
|))
assert @schema_sdl.include?(%|id: ID! @source(location: "alpha") @source(location: "bravo")|)
assert @schema_sdl.include?(%|a: String @source(location: "alpha")|)
assert @schema_sdl.include?(%|b: String @source(location: "bravo")|)
assert @schema_sdl.include?(%|a(id: ID!): A @source(location: "alpha")|)
assert @schema_sdl.include?(%|a(id: ID!): I @source(location: "alpha")|)
assert @schema_sdl.include?(%|b(id: ID!): T @source(location: "bravo")|)
end

Expand All @@ -365,6 +365,7 @@ def test_from_definition_restores_supergraph
assert_equal @supergraph.boundaries, supergraph_import.boundaries
assert_equal ["alpha", "bravo"], supergraph_import.locations.sort
assert_equal @supergraph.schema.types.keys.sort, supergraph_import.schema.types.keys.sort
assert_equal @supergraph.boundaries, supergraph_import.boundaries
end

def test_normalizes_executable_location_names
Expand Down

0 comments on commit 14983f6

Please sign in to comment.