diff --git a/composition-js/src/__tests__/composeFed1Subgraphs.test.ts b/composition-js/src/__tests__/composeFed1Subgraphs.test.ts index 8e39b4b00..80ca6b23c 100644 --- a/composition-js/src/__tests__/composeFed1Subgraphs.test.ts +++ b/composition-js/src/__tests__/composeFed1Subgraphs.test.ts @@ -744,4 +744,40 @@ describe('override', () => { const result = composeServices([subgraphA,]); assertCompositionSuccess(result); }); + + it('@requires on a key selecting another field', () => { + const subgraphA = { + typeDefs: gql` + type Query { + T: T! + } + + type T @key(fields: "a") { + a: String + d: String + } + `, + name: 'subgraphA', + }; + + const subgraphB = { + typeDefs: gql` + type Query { + foo: T + } + + type T @key(fields: "a") @extends { + a: String @external @requires(fields: "d") + d: String @external + } + `, + name: 'subgraphB', + }; + + const result = composeServices([subgraphA, subgraphB]); + + expect(result.errors).toBeDefined(); + expect(errors(result)).toStrictEqual([ + ]); + }); });