File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,40 @@ type Mutation {
253
253
var output = cycleOutput ( body , 'HelloScalars' , 'Mutation' ) ;
254
254
expect ( output ) . to . equal ( body ) ;
255
255
} ) ;
256
+
257
+ it ( 'Unreferenced type implementing referenced interface' , ( ) => {
258
+ var body = `
259
+ type Concrete implements Iface {
260
+ key: String
261
+ }
262
+
263
+ interface Iface {
264
+ key: String
265
+ }
266
+
267
+ type Query {
268
+ iface: Iface
269
+ }
270
+ ` ;
271
+ var output = cycleOutput ( body , 'Query' ) ;
272
+ expect ( output ) . to . equal ( body ) ;
273
+ } ) ;
274
+
275
+ it ( 'Unreferenced type implementing referenced union' , ( ) => {
276
+ var body = `
277
+ type Concrete {
278
+ key: String
279
+ }
280
+
281
+ type Query {
282
+ union: Union
283
+ }
284
+
285
+ union Union = Concrete
286
+ ` ;
287
+ var output = cycleOutput ( body , 'Query' ) ;
288
+ expect ( output ) . to . equal ( body ) ;
289
+ } ) ;
256
290
} ) ;
257
291
258
292
describe ( 'Schema Parser Failures' , ( ) => {
Original file line number Diff line number Diff line change @@ -140,13 +140,14 @@ export function buildASTSchema(
140
140
} ;
141
141
}
142
142
143
-
144
143
var produceTypeDef = getTypeDefProducer ( ast ) ;
145
144
146
145
if ( isNullish ( astMap [ queryTypeName ] ) ) {
147
146
throw new Error ( `Type ${ queryTypeName } not found in document` ) ;
148
147
}
149
148
149
+ ast . definitions . forEach ( produceTypeDef ) ;
150
+
150
151
var queryType = produceTypeDef ( astMap [ queryTypeName ] ) ;
151
152
var schema ;
152
153
if ( isNullish ( mutationTypeName ) ) {
You can’t perform that action at this time.
0 commit comments