@@ -143,11 +143,18 @@ async function expectPromise(promise: Promise<mixed>) {
143
143
} ;
144
144
}
145
145
146
+ const DummyQueryType = new GraphQLObjectType ( {
147
+ name : 'Query' ,
148
+ fields : {
149
+ dummy : { type : GraphQLString } ,
150
+ } ,
151
+ } ) ;
152
+
146
153
// Check all error cases when initializing the subscription.
147
154
describe ( 'Subscription Initialization Phase' , ( ) => {
148
155
it ( 'accepts multiple subscription fields defined in schema' , async ( ) => {
149
156
const schema = new GraphQLSchema ( {
150
- query : QueryType ,
157
+ query : DummyQueryType ,
151
158
subscription : new GraphQLObjectType ( {
152
159
name : 'Subscription' ,
153
160
fields : {
@@ -183,7 +190,7 @@ describe('Subscription Initialization Phase', () => {
183
190
}
184
191
185
192
const schema = new GraphQLSchema ( {
186
- query : QueryType ,
193
+ query : DummyQueryType ,
187
194
subscription : new GraphQLObjectType ( {
188
195
name : 'Subscription' ,
189
196
fields : {
@@ -216,7 +223,7 @@ describe('Subscription Initialization Phase', () => {
216
223
}
217
224
218
225
const schema = new GraphQLSchema ( {
219
- query : QueryType ,
226
+ query : DummyQueryType ,
220
227
subscription : new GraphQLObjectType ( {
221
228
name : 'Subscription' ,
222
229
fields : {
@@ -255,7 +262,7 @@ describe('Subscription Initialization Phase', () => {
255
262
let didResolveBar = false ;
256
263
257
264
const schema = new GraphQLSchema ( {
258
- query : QueryType ,
265
+ query : DummyQueryType ,
259
266
subscription : new GraphQLObjectType ( {
260
267
name : 'Subscription' ,
261
268
fields : {
@@ -267,7 +274,7 @@ describe('Subscription Initialization Phase', () => {
267
274
} ,
268
275
} ,
269
276
bar : {
270
- type : EmailEventType ,
277
+ type : GraphQLString ,
271
278
// istanbul ignore next (Shouldn't be called)
272
279
subscribe ( ) {
273
280
didResolveBar = true ;
@@ -295,7 +302,7 @@ describe('Subscription Initialization Phase', () => {
295
302
it ( 'throws an error if some of required arguments are missing' , async ( ) => {
296
303
const document = parse ( 'subscription { foo }' ) ;
297
304
const schema = new GraphQLSchema ( {
298
- query : QueryType ,
305
+ query : DummyQueryType ,
299
306
subscription : new GraphQLObjectType ( {
300
307
name : 'Subscription' ,
301
308
fields : {
@@ -327,7 +334,7 @@ describe('Subscription Initialization Phase', () => {
327
334
328
335
it ( 'resolves to an error for unknown subscription field' , async ( ) => {
329
336
const schema = new GraphQLSchema ( {
330
- query : QueryType ,
337
+ query : DummyQueryType ,
331
338
subscription : new GraphQLObjectType ( {
332
339
name : 'Subscription' ,
333
340
fields : {
@@ -350,7 +357,7 @@ describe('Subscription Initialization Phase', () => {
350
357
351
358
it ( 'should pass through unexpected errors thrown in subscribe' , async ( ) => {
352
359
const schema = new GraphQLSchema ( {
353
- query : QueryType ,
360
+ query : DummyQueryType ,
354
361
subscription : new GraphQLObjectType ( {
355
362
name : 'Subscription' ,
356
363
fields : {
@@ -365,7 +372,7 @@ describe('Subscription Initialization Phase', () => {
365
372
366
373
it ( 'throws an error if subscribe does not return an iterator' , async ( ) => {
367
374
const schema = new GraphQLSchema ( {
368
- query : QueryType ,
375
+ query : DummyQueryType ,
369
376
subscription : new GraphQLObjectType ( {
370
377
name : 'Subscription' ,
371
378
fields : {
@@ -387,7 +394,7 @@ describe('Subscription Initialization Phase', () => {
387
394
it ( 'resolves to an error for subscription resolver errors' , async ( ) => {
388
395
async function subscribeWithFn ( subscribeFn : ( ) = > mixed ) {
389
396
const schema = new GraphQLSchema ( {
390
- query : QueryType ,
397
+ query : DummyQueryType ,
391
398
subscription : new GraphQLObjectType ( {
392
399
name : 'Subscription' ,
393
400
fields : {
@@ -439,7 +446,7 @@ describe('Subscription Initialization Phase', () => {
439
446
440
447
it ( 'resolves to an error if variables were wrong type' , async ( ) => {
441
448
const schema = new GraphQLSchema ( {
442
- query : QueryType ,
449
+ query : DummyQueryType ,
443
450
subscription : new GraphQLObjectType ( {
444
451
name : 'Subscription' ,
445
452
fields : {
@@ -853,7 +860,7 @@ describe('Subscription Publish Phase', () => {
853
860
}
854
861
855
862
const schema = new GraphQLSchema ( {
856
- query : QueryType ,
863
+ query : DummyQueryType ,
857
864
subscription : new GraphQLObjectType ( {
858
865
name : 'Subscription' ,
859
866
fields : {
@@ -914,7 +921,7 @@ describe('Subscription Publish Phase', () => {
914
921
}
915
922
916
923
const schema = new GraphQLSchema ( {
917
- query : QueryType ,
924
+ query : DummyQueryType ,
918
925
subscription : new GraphQLObjectType ( {
919
926
name : 'Subscription' ,
920
927
fields : {
0 commit comments