@@ -64,44 +64,44 @@ describe('Type System: Specified scalar types', () => {
64
64
) ;
65
65
} ) ;
66
66
67
- it ( 'parseLiteral ' , ( ) => {
68
- function parseLiteral ( str : string ) {
69
- return GraphQLInt . parseLiteral ( parseConstValue ( str ) ) ;
67
+ it ( 'parseConstLiteral ' , ( ) => {
68
+ function parseConstLiteral ( str : string ) {
69
+ return GraphQLInt . parseConstLiteral ( parseConstValue ( str ) ) ;
70
70
}
71
71
72
- expect ( parseLiteral ( '1' ) ) . to . equal ( 1 ) ;
73
- expect ( parseLiteral ( '0' ) ) . to . equal ( 0 ) ;
74
- expect ( parseLiteral ( '-1' ) ) . to . equal ( - 1 ) ;
72
+ expect ( parseConstLiteral ( '1' ) ) . to . equal ( 1 ) ;
73
+ expect ( parseConstLiteral ( '0' ) ) . to . equal ( 0 ) ;
74
+ expect ( parseConstLiteral ( '-1' ) ) . to . equal ( - 1 ) ;
75
75
76
- expect ( ( ) => parseLiteral ( '9876504321' ) ) . to . throw (
76
+ expect ( ( ) => parseConstLiteral ( '9876504321' ) ) . to . throw (
77
77
'Int cannot represent non 32-bit signed integer value: 9876504321' ,
78
78
) ;
79
- expect ( ( ) => parseLiteral ( '-9876504321' ) ) . to . throw (
79
+ expect ( ( ) => parseConstLiteral ( '-9876504321' ) ) . to . throw (
80
80
'Int cannot represent non 32-bit signed integer value: -9876504321' ,
81
81
) ;
82
82
83
- expect ( ( ) => parseLiteral ( '1.0' ) ) . to . throw (
83
+ expect ( ( ) => parseConstLiteral ( '1.0' ) ) . to . throw (
84
84
'Int cannot represent non-integer value: 1.0' ,
85
85
) ;
86
- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
86
+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
87
87
'Int cannot represent non-integer value: null' ,
88
88
) ;
89
- expect ( ( ) => parseLiteral ( '""' ) ) . to . throw (
89
+ expect ( ( ) => parseConstLiteral ( '""' ) ) . to . throw (
90
90
'Int cannot represent non-integer value: ""' ,
91
91
) ;
92
- expect ( ( ) => parseLiteral ( '"123"' ) ) . to . throw (
92
+ expect ( ( ) => parseConstLiteral ( '"123"' ) ) . to . throw (
93
93
'Int cannot represent non-integer value: "123"' ,
94
94
) ;
95
- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
95
+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
96
96
'Int cannot represent non-integer value: false' ,
97
97
) ;
98
- expect ( ( ) => parseLiteral ( '[1]' ) ) . to . throw (
98
+ expect ( ( ) => parseConstLiteral ( '[1]' ) ) . to . throw (
99
99
'Int cannot represent non-integer value: [1]' ,
100
100
) ;
101
- expect ( ( ) => parseLiteral ( '{ value: 1 }' ) ) . to . throw (
101
+ expect ( ( ) => parseConstLiteral ( '{ value: 1 }' ) ) . to . throw (
102
102
'Int cannot represent non-integer value: { value: 1 }' ,
103
103
) ;
104
- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
104
+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
105
105
'Int cannot represent non-integer value: ENUM_VALUE' ,
106
106
) ;
107
107
} ) ;
@@ -226,39 +226,39 @@ describe('Type System: Specified scalar types', () => {
226
226
) ;
227
227
} ) ;
228
228
229
- it ( 'parseLiteral ' , ( ) => {
230
- function parseLiteral ( str : string ) {
231
- return GraphQLFloat . parseLiteral ( parseConstValue ( str ) ) ;
229
+ it ( 'parseConstLiteral ' , ( ) => {
230
+ function parseConstLiteral ( str : string ) {
231
+ return GraphQLFloat . parseConstLiteral ( parseConstValue ( str ) ) ;
232
232
}
233
233
234
- expect ( parseLiteral ( '1' ) ) . to . equal ( 1 ) ;
235
- expect ( parseLiteral ( '0' ) ) . to . equal ( 0 ) ;
236
- expect ( parseLiteral ( '-1' ) ) . to . equal ( - 1 ) ;
237
- expect ( parseLiteral ( '0.1' ) ) . to . equal ( 0.1 ) ;
238
- expect ( parseLiteral ( Math . PI . toString ( ) ) ) . to . equal ( Math . PI ) ;
234
+ expect ( parseConstLiteral ( '1' ) ) . to . equal ( 1 ) ;
235
+ expect ( parseConstLiteral ( '0' ) ) . to . equal ( 0 ) ;
236
+ expect ( parseConstLiteral ( '-1' ) ) . to . equal ( - 1 ) ;
237
+ expect ( parseConstLiteral ( '0.1' ) ) . to . equal ( 0.1 ) ;
238
+ expect ( parseConstLiteral ( Math . PI . toString ( ) ) ) . to . equal ( Math . PI ) ;
239
239
240
- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
240
+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
241
241
'Float cannot represent non numeric value: null' ,
242
242
) ;
243
- expect ( ( ) => parseLiteral ( '""' ) ) . to . throw (
243
+ expect ( ( ) => parseConstLiteral ( '""' ) ) . to . throw (
244
244
'Float cannot represent non numeric value: ""' ,
245
245
) ;
246
- expect ( ( ) => parseLiteral ( '"123"' ) ) . to . throw (
246
+ expect ( ( ) => parseConstLiteral ( '"123"' ) ) . to . throw (
247
247
'Float cannot represent non numeric value: "123"' ,
248
248
) ;
249
- expect ( ( ) => parseLiteral ( '"123.5"' ) ) . to . throw (
249
+ expect ( ( ) => parseConstLiteral ( '"123.5"' ) ) . to . throw (
250
250
'Float cannot represent non numeric value: "123.5"' ,
251
251
) ;
252
- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
252
+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
253
253
'Float cannot represent non numeric value: false' ,
254
254
) ;
255
- expect ( ( ) => parseLiteral ( '[0.1]' ) ) . to . throw (
255
+ expect ( ( ) => parseConstLiteral ( '[0.1]' ) ) . to . throw (
256
256
'Float cannot represent non numeric value: [0.1]' ,
257
257
) ;
258
- expect ( ( ) => parseLiteral ( '{ value: 0.1 }' ) ) . to . throw (
258
+ expect ( ( ) => parseConstLiteral ( '{ value: 0.1 }' ) ) . to . throw (
259
259
'Float cannot represent non numeric value: { value: 0.1 }' ,
260
260
) ;
261
- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
261
+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
262
262
'Float cannot represent non numeric value: ENUM_VALUE' ,
263
263
) ;
264
264
} ) ;
@@ -336,33 +336,33 @@ describe('Type System: Specified scalar types', () => {
336
336
) ;
337
337
} ) ;
338
338
339
- it ( 'parseLiteral ' , ( ) => {
340
- function parseLiteral ( str : string ) {
341
- return GraphQLString . parseLiteral ( parseConstValue ( str ) ) ;
339
+ it ( 'parseConstLiteral ' , ( ) => {
340
+ function parseConstLiteral ( str : string ) {
341
+ return GraphQLString . parseConstLiteral ( parseConstValue ( str ) ) ;
342
342
}
343
343
344
- expect ( parseLiteral ( '"foo"' ) ) . to . equal ( 'foo' ) ;
345
- expect ( parseLiteral ( '"""bar"""' ) ) . to . equal ( 'bar' ) ;
344
+ expect ( parseConstLiteral ( '"foo"' ) ) . to . equal ( 'foo' ) ;
345
+ expect ( parseConstLiteral ( '"""bar"""' ) ) . to . equal ( 'bar' ) ;
346
346
347
- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
347
+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
348
348
'String cannot represent a non string value: null' ,
349
349
) ;
350
- expect ( ( ) => parseLiteral ( '1' ) ) . to . throw (
350
+ expect ( ( ) => parseConstLiteral ( '1' ) ) . to . throw (
351
351
'String cannot represent a non string value: 1' ,
352
352
) ;
353
- expect ( ( ) => parseLiteral ( '0.1' ) ) . to . throw (
353
+ expect ( ( ) => parseConstLiteral ( '0.1' ) ) . to . throw (
354
354
'String cannot represent a non string value: 0.1' ,
355
355
) ;
356
- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
356
+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
357
357
'String cannot represent a non string value: false' ,
358
358
) ;
359
- expect ( ( ) => parseLiteral ( '["foo"]' ) ) . to . throw (
359
+ expect ( ( ) => parseConstLiteral ( '["foo"]' ) ) . to . throw (
360
360
'String cannot represent a non string value: ["foo"]' ,
361
361
) ;
362
- expect ( ( ) => parseLiteral ( '{ value: "foo" }' ) ) . to . throw (
362
+ expect ( ( ) => parseConstLiteral ( '{ value: "foo" }' ) ) . to . throw (
363
363
'String cannot represent a non string value: { value: "foo" }' ,
364
364
) ;
365
- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
365
+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
366
366
'String cannot represent a non string value: ENUM_VALUE' ,
367
367
) ;
368
368
} ) ;
@@ -445,39 +445,39 @@ describe('Type System: Specified scalar types', () => {
445
445
) ;
446
446
} ) ;
447
447
448
- it ( 'parseLiteral ' , ( ) => {
449
- function parseLiteral ( str : string ) {
450
- return GraphQLBoolean . parseLiteral ( parseConstValue ( str ) ) ;
448
+ it ( 'parseConstLiteral ' , ( ) => {
449
+ function parseConstLiteral ( str : string ) {
450
+ return GraphQLBoolean . parseConstLiteral ( parseConstValue ( str ) ) ;
451
451
}
452
452
453
- expect ( parseLiteral ( 'true' ) ) . to . equal ( true ) ;
454
- expect ( parseLiteral ( 'false' ) ) . to . equal ( false ) ;
453
+ expect ( parseConstLiteral ( 'true' ) ) . to . equal ( true ) ;
454
+ expect ( parseConstLiteral ( 'false' ) ) . to . equal ( false ) ;
455
455
456
- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
456
+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
457
457
'Boolean cannot represent a non boolean value: null' ,
458
458
) ;
459
- expect ( ( ) => parseLiteral ( '0' ) ) . to . throw (
459
+ expect ( ( ) => parseConstLiteral ( '0' ) ) . to . throw (
460
460
'Boolean cannot represent a non boolean value: 0' ,
461
461
) ;
462
- expect ( ( ) => parseLiteral ( '1' ) ) . to . throw (
462
+ expect ( ( ) => parseConstLiteral ( '1' ) ) . to . throw (
463
463
'Boolean cannot represent a non boolean value: 1' ,
464
464
) ;
465
- expect ( ( ) => parseLiteral ( '0.1' ) ) . to . throw (
465
+ expect ( ( ) => parseConstLiteral ( '0.1' ) ) . to . throw (
466
466
'Boolean cannot represent a non boolean value: 0.1' ,
467
467
) ;
468
- expect ( ( ) => parseLiteral ( '""' ) ) . to . throw (
468
+ expect ( ( ) => parseConstLiteral ( '""' ) ) . to . throw (
469
469
'Boolean cannot represent a non boolean value: ""' ,
470
470
) ;
471
- expect ( ( ) => parseLiteral ( '"false"' ) ) . to . throw (
471
+ expect ( ( ) => parseConstLiteral ( '"false"' ) ) . to . throw (
472
472
'Boolean cannot represent a non boolean value: "false"' ,
473
473
) ;
474
- expect ( ( ) => parseLiteral ( '[false]' ) ) . to . throw (
474
+ expect ( ( ) => parseConstLiteral ( '[false]' ) ) . to . throw (
475
475
'Boolean cannot represent a non boolean value: [false]' ,
476
476
) ;
477
- expect ( ( ) => parseLiteral ( '{ value: false }' ) ) . to . throw (
477
+ expect ( ( ) => parseConstLiteral ( '{ value: false }' ) ) . to . throw (
478
478
'Boolean cannot represent a non boolean value: { value: false }' ,
479
479
) ;
480
- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
480
+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
481
481
'Boolean cannot represent a non boolean value: ENUM_VALUE' ,
482
482
) ;
483
483
} ) ;
@@ -557,39 +557,43 @@ describe('Type System: Specified scalar types', () => {
557
557
) ;
558
558
} ) ;
559
559
560
- it ( 'parseLiteral ' , ( ) => {
561
- function parseLiteral ( str : string ) {
562
- return GraphQLID . parseLiteral ( parseConstValue ( str ) ) ;
560
+ it ( 'parseConstLiteral ' , ( ) => {
561
+ function parseConstLiteral ( str : string ) {
562
+ return GraphQLID . parseConstLiteral ( parseConstValue ( str ) ) ;
563
563
}
564
564
565
- expect ( parseLiteral ( '""' ) ) . to . equal ( '' ) ;
566
- expect ( parseLiteral ( '"1"' ) ) . to . equal ( '1' ) ;
567
- expect ( parseLiteral ( '"foo"' ) ) . to . equal ( 'foo' ) ;
568
- expect ( parseLiteral ( '"""foo"""' ) ) . to . equal ( 'foo' ) ;
569
- expect ( parseLiteral ( '1' ) ) . to . equal ( '1' ) ;
570
- expect ( parseLiteral ( '0' ) ) . to . equal ( '0' ) ;
571
- expect ( parseLiteral ( '-1' ) ) . to . equal ( '-1' ) ;
565
+ expect ( parseConstLiteral ( '""' ) ) . to . equal ( '' ) ;
566
+ expect ( parseConstLiteral ( '"1"' ) ) . to . equal ( '1' ) ;
567
+ expect ( parseConstLiteral ( '"foo"' ) ) . to . equal ( 'foo' ) ;
568
+ expect ( parseConstLiteral ( '"""foo"""' ) ) . to . equal ( 'foo' ) ;
569
+ expect ( parseConstLiteral ( '1' ) ) . to . equal ( '1' ) ;
570
+ expect ( parseConstLiteral ( '0' ) ) . to . equal ( '0' ) ;
571
+ expect ( parseConstLiteral ( '-1' ) ) . to . equal ( '-1' ) ;
572
572
573
573
// Support arbitrary long numbers even if they can't be represented in JS
574
- expect ( parseLiteral ( '90071992547409910' ) ) . to . equal ( '90071992547409910' ) ;
575
- expect ( parseLiteral ( '-90071992547409910' ) ) . to . equal ( '-90071992547409910' ) ;
574
+ expect ( parseConstLiteral ( '90071992547409910' ) ) . to . equal (
575
+ '90071992547409910' ,
576
+ ) ;
577
+ expect ( parseConstLiteral ( '-90071992547409910' ) ) . to . equal (
578
+ '-90071992547409910' ,
579
+ ) ;
576
580
577
- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
581
+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
578
582
'ID cannot represent a non-string and non-integer value: null' ,
579
583
) ;
580
- expect ( ( ) => parseLiteral ( '0.1' ) ) . to . throw (
584
+ expect ( ( ) => parseConstLiteral ( '0.1' ) ) . to . throw (
581
585
'ID cannot represent a non-string and non-integer value: 0.1' ,
582
586
) ;
583
- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
587
+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
584
588
'ID cannot represent a non-string and non-integer value: false' ,
585
589
) ;
586
- expect ( ( ) => parseLiteral ( '["1"]' ) ) . to . throw (
590
+ expect ( ( ) => parseConstLiteral ( '["1"]' ) ) . to . throw (
587
591
'ID cannot represent a non-string and non-integer value: ["1"]' ,
588
592
) ;
589
- expect ( ( ) => parseLiteral ( '{ value: "1" }' ) ) . to . throw (
593
+ expect ( ( ) => parseConstLiteral ( '{ value: "1" }' ) ) . to . throw (
590
594
'ID cannot represent a non-string and non-integer value: { value: "1" }' ,
591
595
) ;
592
- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
596
+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
593
597
'ID cannot represent a non-string and non-integer value: ENUM_VALUE' ,
594
598
) ;
595
599
} ) ;
0 commit comments