@@ -64,44 +64,44 @@ describe('Type System: Specified scalar types', () => {
6464 ) ;
6565 } ) ;
6666
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 ) ) ;
7070 }
7171
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 ) ;
7575
76- expect ( ( ) => parseLiteral ( '9876504321' ) ) . to . throw (
76+ expect ( ( ) => parseConstLiteral ( '9876504321' ) ) . to . throw (
7777 'Int cannot represent non 32-bit signed integer value: 9876504321' ,
7878 ) ;
79- expect ( ( ) => parseLiteral ( '-9876504321' ) ) . to . throw (
79+ expect ( ( ) => parseConstLiteral ( '-9876504321' ) ) . to . throw (
8080 'Int cannot represent non 32-bit signed integer value: -9876504321' ,
8181 ) ;
8282
83- expect ( ( ) => parseLiteral ( '1.0' ) ) . to . throw (
83+ expect ( ( ) => parseConstLiteral ( '1.0' ) ) . to . throw (
8484 'Int cannot represent non-integer value: 1.0' ,
8585 ) ;
86- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
86+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
8787 'Int cannot represent non-integer value: null' ,
8888 ) ;
89- expect ( ( ) => parseLiteral ( '""' ) ) . to . throw (
89+ expect ( ( ) => parseConstLiteral ( '""' ) ) . to . throw (
9090 'Int cannot represent non-integer value: ""' ,
9191 ) ;
92- expect ( ( ) => parseLiteral ( '"123"' ) ) . to . throw (
92+ expect ( ( ) => parseConstLiteral ( '"123"' ) ) . to . throw (
9393 'Int cannot represent non-integer value: "123"' ,
9494 ) ;
95- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
95+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
9696 'Int cannot represent non-integer value: false' ,
9797 ) ;
98- expect ( ( ) => parseLiteral ( '[1]' ) ) . to . throw (
98+ expect ( ( ) => parseConstLiteral ( '[1]' ) ) . to . throw (
9999 'Int cannot represent non-integer value: [1]' ,
100100 ) ;
101- expect ( ( ) => parseLiteral ( '{ value: 1 }' ) ) . to . throw (
101+ expect ( ( ) => parseConstLiteral ( '{ value: 1 }' ) ) . to . throw (
102102 'Int cannot represent non-integer value: { value: 1 }' ,
103103 ) ;
104- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
104+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
105105 'Int cannot represent non-integer value: ENUM_VALUE' ,
106106 ) ;
107107 } ) ;
@@ -226,39 +226,39 @@ describe('Type System: Specified scalar types', () => {
226226 ) ;
227227 } ) ;
228228
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 ) ) ;
232232 }
233233
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 ) ;
239239
240- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
240+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
241241 'Float cannot represent non numeric value: null' ,
242242 ) ;
243- expect ( ( ) => parseLiteral ( '""' ) ) . to . throw (
243+ expect ( ( ) => parseConstLiteral ( '""' ) ) . to . throw (
244244 'Float cannot represent non numeric value: ""' ,
245245 ) ;
246- expect ( ( ) => parseLiteral ( '"123"' ) ) . to . throw (
246+ expect ( ( ) => parseConstLiteral ( '"123"' ) ) . to . throw (
247247 'Float cannot represent non numeric value: "123"' ,
248248 ) ;
249- expect ( ( ) => parseLiteral ( '"123.5"' ) ) . to . throw (
249+ expect ( ( ) => parseConstLiteral ( '"123.5"' ) ) . to . throw (
250250 'Float cannot represent non numeric value: "123.5"' ,
251251 ) ;
252- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
252+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
253253 'Float cannot represent non numeric value: false' ,
254254 ) ;
255- expect ( ( ) => parseLiteral ( '[0.1]' ) ) . to . throw (
255+ expect ( ( ) => parseConstLiteral ( '[0.1]' ) ) . to . throw (
256256 'Float cannot represent non numeric value: [0.1]' ,
257257 ) ;
258- expect ( ( ) => parseLiteral ( '{ value: 0.1 }' ) ) . to . throw (
258+ expect ( ( ) => parseConstLiteral ( '{ value: 0.1 }' ) ) . to . throw (
259259 'Float cannot represent non numeric value: { value: 0.1 }' ,
260260 ) ;
261- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
261+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
262262 'Float cannot represent non numeric value: ENUM_VALUE' ,
263263 ) ;
264264 } ) ;
@@ -336,33 +336,33 @@ describe('Type System: Specified scalar types', () => {
336336 ) ;
337337 } ) ;
338338
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 ) ) ;
342342 }
343343
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' ) ;
346346
347- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
347+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
348348 'String cannot represent a non string value: null' ,
349349 ) ;
350- expect ( ( ) => parseLiteral ( '1' ) ) . to . throw (
350+ expect ( ( ) => parseConstLiteral ( '1' ) ) . to . throw (
351351 'String cannot represent a non string value: 1' ,
352352 ) ;
353- expect ( ( ) => parseLiteral ( '0.1' ) ) . to . throw (
353+ expect ( ( ) => parseConstLiteral ( '0.1' ) ) . to . throw (
354354 'String cannot represent a non string value: 0.1' ,
355355 ) ;
356- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
356+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
357357 'String cannot represent a non string value: false' ,
358358 ) ;
359- expect ( ( ) => parseLiteral ( '["foo"]' ) ) . to . throw (
359+ expect ( ( ) => parseConstLiteral ( '["foo"]' ) ) . to . throw (
360360 'String cannot represent a non string value: ["foo"]' ,
361361 ) ;
362- expect ( ( ) => parseLiteral ( '{ value: "foo" }' ) ) . to . throw (
362+ expect ( ( ) => parseConstLiteral ( '{ value: "foo" }' ) ) . to . throw (
363363 'String cannot represent a non string value: { value: "foo" }' ,
364364 ) ;
365- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
365+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
366366 'String cannot represent a non string value: ENUM_VALUE' ,
367367 ) ;
368368 } ) ;
@@ -445,39 +445,39 @@ describe('Type System: Specified scalar types', () => {
445445 ) ;
446446 } ) ;
447447
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 ) ) ;
451451 }
452452
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 ) ;
455455
456- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
456+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
457457 'Boolean cannot represent a non boolean value: null' ,
458458 ) ;
459- expect ( ( ) => parseLiteral ( '0' ) ) . to . throw (
459+ expect ( ( ) => parseConstLiteral ( '0' ) ) . to . throw (
460460 'Boolean cannot represent a non boolean value: 0' ,
461461 ) ;
462- expect ( ( ) => parseLiteral ( '1' ) ) . to . throw (
462+ expect ( ( ) => parseConstLiteral ( '1' ) ) . to . throw (
463463 'Boolean cannot represent a non boolean value: 1' ,
464464 ) ;
465- expect ( ( ) => parseLiteral ( '0.1' ) ) . to . throw (
465+ expect ( ( ) => parseConstLiteral ( '0.1' ) ) . to . throw (
466466 'Boolean cannot represent a non boolean value: 0.1' ,
467467 ) ;
468- expect ( ( ) => parseLiteral ( '""' ) ) . to . throw (
468+ expect ( ( ) => parseConstLiteral ( '""' ) ) . to . throw (
469469 'Boolean cannot represent a non boolean value: ""' ,
470470 ) ;
471- expect ( ( ) => parseLiteral ( '"false"' ) ) . to . throw (
471+ expect ( ( ) => parseConstLiteral ( '"false"' ) ) . to . throw (
472472 'Boolean cannot represent a non boolean value: "false"' ,
473473 ) ;
474- expect ( ( ) => parseLiteral ( '[false]' ) ) . to . throw (
474+ expect ( ( ) => parseConstLiteral ( '[false]' ) ) . to . throw (
475475 'Boolean cannot represent a non boolean value: [false]' ,
476476 ) ;
477- expect ( ( ) => parseLiteral ( '{ value: false }' ) ) . to . throw (
477+ expect ( ( ) => parseConstLiteral ( '{ value: false }' ) ) . to . throw (
478478 'Boolean cannot represent a non boolean value: { value: false }' ,
479479 ) ;
480- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
480+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
481481 'Boolean cannot represent a non boolean value: ENUM_VALUE' ,
482482 ) ;
483483 } ) ;
@@ -557,39 +557,43 @@ describe('Type System: Specified scalar types', () => {
557557 ) ;
558558 } ) ;
559559
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 ) ) ;
563563 }
564564
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' ) ;
572572
573573 // 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+ ) ;
576580
577- expect ( ( ) => parseLiteral ( 'null' ) ) . to . throw (
581+ expect ( ( ) => parseConstLiteral ( 'null' ) ) . to . throw (
578582 'ID cannot represent a non-string and non-integer value: null' ,
579583 ) ;
580- expect ( ( ) => parseLiteral ( '0.1' ) ) . to . throw (
584+ expect ( ( ) => parseConstLiteral ( '0.1' ) ) . to . throw (
581585 'ID cannot represent a non-string and non-integer value: 0.1' ,
582586 ) ;
583- expect ( ( ) => parseLiteral ( 'false' ) ) . to . throw (
587+ expect ( ( ) => parseConstLiteral ( 'false' ) ) . to . throw (
584588 'ID cannot represent a non-string and non-integer value: false' ,
585589 ) ;
586- expect ( ( ) => parseLiteral ( '["1"]' ) ) . to . throw (
590+ expect ( ( ) => parseConstLiteral ( '["1"]' ) ) . to . throw (
587591 'ID cannot represent a non-string and non-integer value: ["1"]' ,
588592 ) ;
589- expect ( ( ) => parseLiteral ( '{ value: "1" }' ) ) . to . throw (
593+ expect ( ( ) => parseConstLiteral ( '{ value: "1" }' ) ) . to . throw (
590594 'ID cannot represent a non-string and non-integer value: { value: "1" }' ,
591595 ) ;
592- expect ( ( ) => parseLiteral ( 'ENUM_VALUE' ) ) . to . throw (
596+ expect ( ( ) => parseConstLiteral ( 'ENUM_VALUE' ) ) . to . throw (
593597 'ID cannot represent a non-string and non-integer value: ENUM_VALUE' ,
594598 ) ;
595599 } ) ;
0 commit comments