diff --git a/packages/load/tests/loaders/schema/schema-from-typedefs.spec.ts b/packages/load/tests/loaders/schema/schema-from-typedefs.spec.ts index 0f118666f20..fe4ad569aa5 100644 --- a/packages/load/tests/loaders/schema/schema-from-typedefs.spec.ts +++ b/packages/load/tests/loaders/schema/schema-from-typedefs.spec.ts @@ -209,7 +209,7 @@ describe('schema from typedefs', () => { }); it('should parse nested import types', async () => { - const glob = './tests/loaders/schema/test-files/nested-imports/query.graphql'; + const glob = './tests/loaders/schema/test-files/nested-imports/query-types.graphql'; const schema = await load(glob, { loaders: [new GraphQLFileLoader()], }); @@ -219,5 +219,18 @@ describe('schema from typedefs', () => { expect(schema.getTypeMap()['Bar']).toBeDefined(); expect(schema.getTypeMap()['Ham']).toBeDefined(); }); + + it('should parse nested import types with interfaces', async () => { + const glob = './tests/loaders/schema/test-files/nested-imports/query-interfaces.graphql'; + const schema = await load(glob, { + loaders: [new GraphQLFileLoader()] + }); + + expect(schema.getTypeMap()['Query']).toBeDefined(); + expect(schema.getTypeMap()['Foo']).toBeDefined(); + expect(schema.getTypeMap()['Cat']).toBeDefined(); + expect(schema.getTypeMap()['Dog']).toBeDefined(); + expect(schema.getTypeMap()['Pet']).toBeDefined(); + }); }); }); diff --git a/packages/load/tests/loaders/schema/test-files/nested-imports/interfaces.graphql b/packages/load/tests/loaders/schema/test-files/nested-imports/interfaces.graphql new file mode 100644 index 00000000000..ed1d2cd389c --- /dev/null +++ b/packages/load/tests/loaders/schema/test-files/nested-imports/interfaces.graphql @@ -0,0 +1,19 @@ +interface Animal { + legs: Int! +} + +type Cat implements Animal { + color: String! + legs: Int! +} + +type Dog implements Animal { + legs: Int! + type: String! +} + +union Pet = Cat | Dog + +type Foo { + pet: Pet +} diff --git a/packages/load/tests/loaders/schema/test-files/nested-imports/query-interfaces.graphql b/packages/load/tests/loaders/schema/test-files/nested-imports/query-interfaces.graphql new file mode 100644 index 00000000000..069bce7e873 --- /dev/null +++ b/packages/load/tests/loaders/schema/test-files/nested-imports/query-interfaces.graphql @@ -0,0 +1,5 @@ +# import Foo from './interfaces.graphql' + +type Query { + foo: Foo +} diff --git a/packages/load/tests/loaders/schema/test-files/nested-imports/query.graphql b/packages/load/tests/loaders/schema/test-files/nested-imports/query-types.graphql similarity index 100% rename from packages/load/tests/loaders/schema/test-files/nested-imports/query.graphql rename to packages/load/tests/loaders/schema/test-files/nested-imports/query-types.graphql