Skip to content

Commit 58d66d8

Browse files
committed
Add failing test for directive's input types in getTypeMap()
1 parent fd4a69c commit 58d66d8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/type/__tests__/schema-test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
GraphQLInterfaceType,
1111
GraphQLObjectType,
1212
GraphQLString,
13+
GraphQLInputObjectType,
14+
GraphQLDirective,
1315
} from '../';
1416

1517
import { describe, it } from 'mocha';
@@ -26,6 +28,25 @@ const ImplementingType = new GraphQLObjectType({
2628
fields: { fieldName: { type: GraphQLString, resolve: () => '' } },
2729
});
2830

31+
const DirectiveInputType = new GraphQLInputObjectType({
32+
name: 'DirInput',
33+
fields: {
34+
field: {
35+
type: GraphQLString,
36+
},
37+
},
38+
});
39+
40+
const Directive = new GraphQLDirective({
41+
name: 'dir',
42+
locations: ['OBJECT'],
43+
args: {
44+
arg: {
45+
type: DirectiveInputType,
46+
},
47+
},
48+
});
49+
2950
const Schema = new GraphQLSchema({
3051
query: new GraphQLObjectType({
3152
name: 'Query',
@@ -38,6 +59,7 @@ const Schema = new GraphQLSchema({
3859
},
3960
},
4061
}),
62+
directives: [Directive],
4163
});
4264

4365
describe('Type System: Schema', () => {
@@ -53,4 +75,10 @@ describe('Type System: Schema', () => {
5375
);
5476
});
5577
});
78+
79+
describe('Type Map', () => {
80+
it('includes input types only used in directives', () => {
81+
expect(Schema.getTypeMap()['DirInput']).toBeDefined();
82+
});
83+
});
5684
});

0 commit comments

Comments
 (0)