diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts index 10166c2e37..e60ebfbeb4 100644 --- a/src/type/__tests__/introspection-test.ts +++ b/src/type/__tests__/introspection-test.ts @@ -1796,6 +1796,64 @@ describe('Introspection', () => { }); }); + it('returns null for descriptions of wrapping types', () => { + const schema = buildSchema(` + """Object description""" + type SomeObject { + listField: [SomeObject] + nonNullField: SomeObject! + } + + schema { + query: SomeObject + } + `); + + const source = ` + { + __type(name: "SomeObject") { + description + fields { + name + type { + kind + description + ofType { + description + } + } + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + description: 'Object description', + fields: [ + { + name: 'listField', + type: { + kind: 'LIST', + description: null, + ofType: { description: 'Object description' }, + }, + }, + { + name: 'nonNullField', + type: { + kind: 'NON_NULL', + description: null, + ofType: { description: 'Object description' }, + }, + }, + ], + }, + }, + }); + }); + it('executes an introspection query without calling global resolvers', () => { const schema = buildSchema(` type Query { diff --git a/src/type/introspection.ts b/src/type/introspection.ts index 2698d51e96..01ff516601 100644 --- a/src/type/introspection.ts +++ b/src/type/introspection.ts @@ -282,8 +282,6 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({ description: { type: GraphQLString, resolve: (type) => - // FIXME: add test case - /* node:coverage ignore next */ 'description' in type ? type.description : undefined, }, specifiedByURL: {