Skip to content

Commit df52ebf

Browse files
committed
one missing type multiple times in a single type
1 parent 5138eb1 commit df52ebf

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
-52 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type Fixture {
2+
first: Foo
3+
second: Foo
4+
third: Foo
5+
}

packages/import/tests/schema/import-schema.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,39 @@ ${path.resolve(__dirname, './fixtures/type-not-found/g.graphql')}:2:19
940940
}
941941
});
942942

943+
test('one type missing multiple times in a single type', () => {
944+
try {
945+
importSchema('./fixtures/type-not-found/h.graphql');
946+
throw new Error();
947+
} catch (e: any) {
948+
expect(e).toBeInstanceOf(GraphQLError);
949+
expect(e.message).toBe(`Couldn't find type Foo in any of the schemas.`);
950+
expect(e.toString()).toBe(
951+
`
952+
Couldn't find type Foo in any of the schemas.
953+
954+
${path.resolve(__dirname, './fixtures/type-not-found/h.graphql')}:2:10
955+
1 | type Fixture {
956+
2 | first: Foo
957+
| ^
958+
3 | second: Foo
959+
960+
${path.resolve(__dirname, './fixtures/type-not-found/h.graphql')}:3:11
961+
2 | first: Foo
962+
3 | second: Foo
963+
| ^
964+
4 | third: Foo
965+
966+
${path.resolve(__dirname, './fixtures/type-not-found/h.graphql')}:4:10
967+
3 | second: Foo
968+
4 | third: Foo
969+
| ^
970+
5 | }
971+
`.trim(),
972+
);
973+
}
974+
});
975+
943976
test('import with collision', () => {
944977
// Local type gets preference over imported type
945978
const expectedSDL = /* GraphQL */ `

0 commit comments

Comments
 (0)