Skip to content

Commit

Permalink
Expand test for invalid inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Aug 18, 2024
1 parent 285422e commit 40b735f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/__tests__/api.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ describe('graphql()', () => {
}
`);

// NOTE: BigTodo's fields shouldn't be included here
const nestedFragment = graphql(`
fragment Object on SmallTodo @_unmask {
maxLength
... on ITodo {
id
... on BigTodo {
wallOfText
}
}
}
`);

expectTypeOf<FragmentOf<typeof objectFragment>>().toEqualTypeOf<{
__typename: 'SmallTodo';
id: string;
Expand All @@ -189,6 +202,11 @@ describe('graphql()', () => {
id: string;
maxLength: number | null;
}>();

expectTypeOf<FragmentOf<typeof nestedFragment>>().toEqualTypeOf<{
id: string;
maxLength: number | null;
}>();
});

it('should preserve object literal types for variables', () => {
Expand Down

0 comments on commit 40b735f

Please sign in to comment.