Skip to content

Commit

Permalink
Rep test for infinite recursion with @requires
Browse files Browse the repository at this point in the history
  • Loading branch information
tinnou committed Jul 2, 2024
1 parent a4e105e commit f4d0b19
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions composition-js/src/__tests__/composeFed1Subgraphs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
]);
});
});

0 comments on commit f4d0b19

Please sign in to comment.