@@ -211,7 +211,7 @@ describe('ParseGraphQLSchema', () => {
211
211
} ) ;
212
212
} ) ;
213
213
214
- describe ( 'addGraphQLObjectQuery ' , ( ) => {
214
+ describe ( 'addGraphQLQuery ' , ( ) => {
215
215
it ( 'should not load and warn duplicated queries' , async ( ) => {
216
216
let logged = false ;
217
217
const parseGraphQLSchema = new ParseGraphQLSchema ( {
@@ -221,21 +221,19 @@ describe('ParseGraphQLSchema', () => {
221
221
warn : message => {
222
222
logged = true ;
223
223
expect ( message ) . toEqual (
224
- 'Object query someClasses could not be added to the auto schema because it collided with an existing field.'
224
+ 'Query someClasses could not be added to the auto schema because it collided with an existing field.'
225
225
) ;
226
226
} ,
227
227
} ,
228
228
} ) ;
229
229
await parseGraphQLSchema . load ( ) ;
230
230
const field = { } ;
231
- expect (
232
- parseGraphQLSchema . addGraphQLObjectQuery ( 'someClasses' , field )
233
- ) . toBe ( field ) ;
234
- expect ( parseGraphQLSchema . graphQLObjectsQueries [ 'someClasses' ] ) . toBe (
231
+ expect ( parseGraphQLSchema . addGraphQLQuery ( 'someClasses' , field ) ) . toBe (
235
232
field
236
233
) ;
234
+ expect ( parseGraphQLSchema . graphQLQueries [ 'someClasses' ] ) . toBe ( field ) ;
237
235
expect (
238
- parseGraphQLSchema . addGraphQLObjectQuery ( 'someClasses' , { } )
236
+ parseGraphQLSchema . addGraphQLQuery ( 'someClasses' , { } )
239
237
) . toBeUndefined ( ) ;
240
238
expect ( logged ) . toBeTruthy ( ) ;
241
239
} ) ;
@@ -252,16 +250,14 @@ describe('ParseGraphQLSchema', () => {
252
250
} ) ;
253
251
await parseGraphQLSchema . load ( ) ;
254
252
const field = { } ;
255
- expect (
256
- parseGraphQLSchema . addGraphQLObjectQuery ( 'someClasses' , field )
257
- ) . toBe ( field ) ;
258
- expect ( parseGraphQLSchema . graphQLObjectsQueries [ 'someClasses' ] ) . toBe (
253
+ expect ( parseGraphQLSchema . addGraphQLQuery ( 'someClasses' , field ) ) . toBe (
259
254
field
260
255
) ;
256
+ expect ( parseGraphQLSchema . graphQLQueries [ 'someClasses' ] ) . toBe ( field ) ;
261
257
expect ( ( ) =>
262
- parseGraphQLSchema . addGraphQLObjectQuery ( 'someClasses' , { } , true )
258
+ parseGraphQLSchema . addGraphQLQuery ( 'someClasses' , { } , true )
263
259
) . toThrowError (
264
- 'Object query someClasses could not be added to the auto schema because it collided with an existing field.'
260
+ 'Query someClasses could not be added to the auto schema because it collided with an existing field.'
265
261
) ;
266
262
} ) ;
267
263
@@ -274,15 +270,13 @@ describe('ParseGraphQLSchema', () => {
274
270
warn : message => {
275
271
logged = true ;
276
272
expect ( message ) . toEqual (
277
- 'Object query get could not be added to the auto schema because it collided with an existing field.'
273
+ 'Query get could not be added to the auto schema because it collided with an existing field.'
278
274
) ;
279
275
} ,
280
276
} ,
281
277
} ) ;
282
278
await parseGraphQLSchema . load ( ) ;
283
- expect (
284
- parseGraphQLSchema . addGraphQLObjectQuery ( 'get' , { } )
285
- ) . toBeUndefined ( ) ;
279
+ expect ( parseGraphQLSchema . addGraphQLQuery ( 'get' , { } ) ) . toBeUndefined ( ) ;
286
280
expect ( logged ) . toBeTruthy ( ) ;
287
281
} ) ;
288
282
@@ -297,16 +291,16 @@ describe('ParseGraphQLSchema', () => {
297
291
} ,
298
292
} ) ;
299
293
await parseGraphQLSchema . load ( ) ;
300
- delete parseGraphQLSchema . graphQLObjectsQueries . get ;
294
+ delete parseGraphQLSchema . graphQLQueries . get ;
301
295
const field = { } ;
302
- expect (
303
- parseGraphQLSchema . addGraphQLObjectQuery ( 'get' , field , true , true )
304
- ) . toBe ( field ) ;
305
- expect ( parseGraphQLSchema . graphQLObjectsQueries [ 'get' ] ) . toBe ( field ) ;
296
+ expect ( parseGraphQLSchema . addGraphQLQuery ( 'get' , field , true , true ) ) . toBe (
297
+ field
298
+ ) ;
299
+ expect ( parseGraphQLSchema . graphQLQueries [ 'get' ] ) . toBe ( field ) ;
306
300
} ) ;
307
301
} ) ;
308
302
309
- describe ( 'addGraphQLObjectMutation ' , ( ) => {
303
+ describe ( 'addGraphQLMutation ' , ( ) => {
310
304
it ( 'should not load and warn duplicated mutations' , async ( ) => {
311
305
let logged = false ;
312
306
const parseGraphQLSchema = new ParseGraphQLSchema ( {
@@ -316,21 +310,21 @@ describe('ParseGraphQLSchema', () => {
316
310
warn : message => {
317
311
logged = true ;
318
312
expect ( message ) . toEqual (
319
- 'Object mutation createSomeClass could not be added to the auto schema because it collided with an existing field.'
313
+ 'Mutation createSomeClass could not be added to the auto schema because it collided with an existing field.'
320
314
) ;
321
315
} ,
322
316
} ,
323
317
} ) ;
324
318
await parseGraphQLSchema . load ( ) ;
325
319
const field = { } ;
326
320
expect (
327
- parseGraphQLSchema . addGraphQLObjectMutation ( 'createSomeClass' , field )
328
- ) . toBe ( field ) ;
329
- expect (
330
- parseGraphQLSchema . graphQLObjectsMutations [ 'createSomeClass' ]
321
+ parseGraphQLSchema . addGraphQLMutation ( 'createSomeClass' , field )
331
322
) . toBe ( field ) ;
323
+ expect ( parseGraphQLSchema . graphQLMutations [ 'createSomeClass' ] ) . toBe (
324
+ field
325
+ ) ;
332
326
expect (
333
- parseGraphQLSchema . addGraphQLObjectMutation ( 'createSomeClass' , { } )
327
+ parseGraphQLSchema . addGraphQLMutation ( 'createSomeClass' , { } )
334
328
) . toBeUndefined ( ) ;
335
329
expect ( logged ) . toBeTruthy ( ) ;
336
330
} ) ;
@@ -348,15 +342,15 @@ describe('ParseGraphQLSchema', () => {
348
342
await parseGraphQLSchema . load ( ) ;
349
343
const field = { } ;
350
344
expect (
351
- parseGraphQLSchema . addGraphQLObjectMutation ( 'createSomeClass' , field )
352
- ) . toBe ( field ) ;
353
- expect (
354
- parseGraphQLSchema . graphQLObjectsMutations [ 'createSomeClass' ]
345
+ parseGraphQLSchema . addGraphQLMutation ( 'createSomeClass' , field )
355
346
) . toBe ( field ) ;
347
+ expect ( parseGraphQLSchema . graphQLMutations [ 'createSomeClass' ] ) . toBe (
348
+ field
349
+ ) ;
356
350
expect ( ( ) =>
357
- parseGraphQLSchema . addGraphQLObjectMutation ( 'createSomeClass' , { } , true )
351
+ parseGraphQLSchema . addGraphQLMutation ( 'createSomeClass' , { } , true )
358
352
) . toThrowError (
359
- 'Object mutation createSomeClass could not be added to the auto schema because it collided with an existing field.'
353
+ 'Mutation createSomeClass could not be added to the auto schema because it collided with an existing field.'
360
354
) ;
361
355
} ) ;
362
356
@@ -369,14 +363,14 @@ describe('ParseGraphQLSchema', () => {
369
363
warn : message => {
370
364
logged = true ;
371
365
expect ( message ) . toEqual (
372
- 'Object mutation create could not be added to the auto schema because it collided with an existing field.'
366
+ 'Mutation create could not be added to the auto schema because it collided with an existing field.'
373
367
) ;
374
368
} ,
375
369
} ,
376
370
} ) ;
377
371
await parseGraphQLSchema . load ( ) ;
378
372
expect (
379
- parseGraphQLSchema . addGraphQLObjectMutation ( 'create' , { } )
373
+ parseGraphQLSchema . addGraphQLMutation ( 'create' , { } )
380
374
) . toBeUndefined ( ) ;
381
375
expect ( logged ) . toBeTruthy ( ) ;
382
376
} ) ;
@@ -392,12 +386,12 @@ describe('ParseGraphQLSchema', () => {
392
386
} ,
393
387
} ) ;
394
388
await parseGraphQLSchema . load ( ) ;
395
- delete parseGraphQLSchema . graphQLObjectsMutations . create ;
389
+ delete parseGraphQLSchema . graphQLMutations . create ;
396
390
const field = { } ;
397
391
expect (
398
- parseGraphQLSchema . addGraphQLObjectMutation ( 'create' , field , true , true )
392
+ parseGraphQLSchema . addGraphQLMutation ( 'create' , field , true , true )
399
393
) . toBe ( field ) ;
400
- expect ( parseGraphQLSchema . graphQLObjectsMutations [ 'create' ] ) . toBe ( field ) ;
394
+ expect ( parseGraphQLSchema . graphQLMutations [ 'create' ] ) . toBe ( field ) ;
401
395
} ) ;
402
396
} ) ;
403
397
@@ -453,27 +447,27 @@ describe('ParseGraphQLSchema', () => {
453
447
await parseGraphQLSchema . databaseController . schemaCache . clear ( ) ;
454
448
const schema1 = await parseGraphQLSchema . load ( ) ;
455
449
const types1 = parseGraphQLSchema . graphQLTypes ;
456
- const objectQueries1 = parseGraphQLSchema . graphQLObjectsQueries ;
457
- const objectMutations1 = parseGraphQLSchema . graphQLObjectsMutations ;
450
+ const queries1 = parseGraphQLSchema . graphQLQueries ;
451
+ const mutations1 = parseGraphQLSchema . graphQLMutations ;
458
452
const user = new Parse . Object ( 'User' ) ;
459
453
await user . save ( ) ;
460
454
await parseGraphQLSchema . databaseController . schemaCache . clear ( ) ;
461
455
const schema2 = await parseGraphQLSchema . load ( ) ;
462
456
const types2 = parseGraphQLSchema . graphQLTypes ;
463
- const objectQueries2 = parseGraphQLSchema . graphQLObjectsQueries ;
464
- const objectMutations2 = parseGraphQLSchema . graphQLObjectsMutations ;
457
+ const queries2 = parseGraphQLSchema . graphQLQueries ;
458
+ const mutations2 = parseGraphQLSchema . graphQLMutations ;
465
459
expect ( schema1 ) . not . toBe ( schema2 ) ;
466
460
expect ( types1 ) . not . toBe ( types2 ) ;
467
461
expect ( types1 . map ( type => type . name ) . sort ( ) ) . toEqual (
468
462
types2 . map ( type => type . name ) . sort ( )
469
463
) ;
470
- expect ( objectQueries1 ) . not . toBe ( objectQueries2 ) ;
471
- expect ( Object . keys ( objectQueries1 ) . sort ( ) ) . toEqual (
472
- Object . keys ( objectQueries2 ) . sort ( )
464
+ expect ( queries1 ) . not . toBe ( queries2 ) ;
465
+ expect ( Object . keys ( queries1 ) . sort ( ) ) . toEqual (
466
+ Object . keys ( queries2 ) . sort ( )
473
467
) ;
474
- expect ( objectMutations1 ) . not . toBe ( objectMutations2 ) ;
475
- expect ( Object . keys ( objectMutations1 ) . sort ( ) ) . toEqual (
476
- Object . keys ( objectMutations2 ) . sort ( )
468
+ expect ( mutations1 ) . not . toBe ( mutations2 ) ;
469
+ expect ( Object . keys ( mutations1 ) . sort ( ) ) . toEqual (
470
+ Object . keys ( mutations2 ) . sort ( )
477
471
) ;
478
472
} ) ;
479
473
@@ -488,27 +482,27 @@ describe('ParseGraphQLSchema', () => {
488
482
await parseGraphQLSchema . databaseController . schemaCache . clear ( ) ;
489
483
const schema1 = await parseGraphQLSchema . load ( ) ;
490
484
const types1 = parseGraphQLSchema . graphQLTypes ;
491
- const objectQueries1 = parseGraphQLSchema . graphQLObjectsQueries ;
492
- const objectMutations1 = parseGraphQLSchema . graphQLObjectsMutations ;
485
+ const queries1 = parseGraphQLSchema . graphQLQueries ;
486
+ const mutations1 = parseGraphQLSchema . graphQLMutations ;
493
487
const car2 = new Parse . Object ( 'car' ) ;
494
488
await car2 . save ( ) ;
495
489
await parseGraphQLSchema . databaseController . schemaCache . clear ( ) ;
496
490
const schema2 = await parseGraphQLSchema . load ( ) ;
497
491
const types2 = parseGraphQLSchema . graphQLTypes ;
498
- const objectQueries2 = parseGraphQLSchema . graphQLObjectsQueries ;
499
- const objectMutations2 = parseGraphQLSchema . graphQLObjectsMutations ;
492
+ const queries2 = parseGraphQLSchema . graphQLQueries ;
493
+ const mutations2 = parseGraphQLSchema . graphQLMutations ;
500
494
expect ( schema1 ) . not . toBe ( schema2 ) ;
501
495
expect ( types1 ) . not . toBe ( types2 ) ;
502
496
expect ( types1 . map ( type => type . name ) . sort ( ) ) . toEqual (
503
497
types2 . map ( type => type . name ) . sort ( )
504
498
) ;
505
- expect ( objectQueries1 ) . not . toBe ( objectQueries2 ) ;
506
- expect ( Object . keys ( objectQueries1 ) . sort ( ) ) . toEqual (
507
- Object . keys ( objectQueries2 ) . sort ( )
499
+ expect ( queries1 ) . not . toBe ( queries2 ) ;
500
+ expect ( Object . keys ( queries1 ) . sort ( ) ) . toEqual (
501
+ Object . keys ( queries2 ) . sort ( )
508
502
) ;
509
- expect ( objectMutations1 ) . not . toBe ( objectMutations2 ) ;
510
- expect ( Object . keys ( objectMutations1 ) . sort ( ) ) . toEqual (
511
- Object . keys ( objectMutations2 ) . sort ( )
503
+ expect ( mutations1 ) . not . toBe ( mutations2 ) ;
504
+ expect ( Object . keys ( mutations1 ) . sort ( ) ) . toEqual (
505
+ Object . keys ( mutations2 ) . sort ( )
512
506
) ;
513
507
} ) ;
514
508
@@ -522,25 +516,25 @@ describe('ParseGraphQLSchema', () => {
522
516
await car . save ( ) ;
523
517
await parseGraphQLSchema . databaseController . schemaCache . clear ( ) ;
524
518
const schema1 = await parseGraphQLSchema . load ( ) ;
525
- const objectQueries1 = parseGraphQLSchema . graphQLObjectsQueries ;
526
- const objectMutations1 = parseGraphQLSchema . graphQLObjectsMutations ;
519
+ const queries1 = parseGraphQLSchema . graphQLQueries ;
520
+ const mutations1 = parseGraphQLSchema . graphQLMutations ;
527
521
const cars = new Parse . Object ( 'cars' ) ;
528
522
await cars . save ( ) ;
529
523
await parseGraphQLSchema . databaseController . schemaCache . clear ( ) ;
530
524
const schema2 = await parseGraphQLSchema . load ( ) ;
531
- const objectQueries2 = parseGraphQLSchema . graphQLObjectsQueries ;
532
- const objectMutations2 = parseGraphQLSchema . graphQLObjectsMutations ;
525
+ const queries2 = parseGraphQLSchema . graphQLQueries ;
526
+ const mutations2 = parseGraphQLSchema . graphQLMutations ;
533
527
expect ( schema1 ) . not . toBe ( schema2 ) ;
534
- expect ( objectQueries1 ) . not . toBe ( objectQueries2 ) ;
535
- expect ( Object . keys ( objectQueries1 ) . sort ( ) ) . toEqual (
536
- Object . keys ( objectQueries2 ) . sort ( )
528
+ expect ( queries1 ) . not . toBe ( queries2 ) ;
529
+ expect ( Object . keys ( queries1 ) . sort ( ) ) . toEqual (
530
+ Object . keys ( queries2 ) . sort ( )
537
531
) ;
538
- expect ( objectMutations1 ) . not . toBe ( objectMutations2 ) ;
532
+ expect ( mutations1 ) . not . toBe ( mutations2 ) ;
539
533
expect (
540
- Object . keys ( objectMutations1 )
534
+ Object . keys ( mutations1 )
541
535
. concat ( 'createCars' , 'updateCars' , 'deleteCars' )
542
536
. sort ( )
543
- ) . toEqual ( Object . keys ( objectMutations2 ) . sort ( ) ) ;
537
+ ) . toEqual ( Object . keys ( mutations2 ) . sort ( ) ) ;
544
538
} ) ;
545
539
} ) ;
546
540
} ) ;
0 commit comments