@@ -317,9 +317,7 @@ describe('Input Values tests on parser', () => {
317317 id: ${ ScalarTypes . ID } = "abcdef"
318318 name: ${ ScalarTypes . String } = "Artur"
319319 emptyName: ${ ScalarTypes . String } = ""
320- noName: ${ ScalarTypes . String }
321320 emptyArray: [${ ScalarTypes . String } ] = []
322- noArray: [${ ScalarTypes . String } ]
323321 age: ${ ScalarTypes . Int } = 28
324322 weight: ${ ScalarTypes . Float } = 73.0
325323 verified: ${ ScalarTypes . Boolean } = true
@@ -434,21 +432,6 @@ describe('Input Values tests on parser', () => {
434432 } ,
435433 ] ,
436434 } ,
437- {
438- name : 'noName' ,
439- type : {
440- fieldType : {
441- name : ScalarTypes . String ,
442- type : Options . name ,
443- } ,
444- } ,
445- data : {
446- type : ValueDefinition . InputValueDefinition ,
447- } ,
448- directives : [ ] ,
449- interfaces : [ ] ,
450- args : [ ] ,
451- } ,
452435 {
453436 name : 'emptyArray' ,
454437 type : {
@@ -464,27 +447,19 @@ describe('Input Values tests on parser', () => {
464447 type : ValueDefinition . InputValueDefinition ,
465448 } ,
466449 directives : [ ] ,
467- args : [ ] ,
468- interfaces : [ ] ,
469- } ,
470- {
471- name : 'noArray' ,
472- type : {
473- fieldType : {
474- type : Options . array ,
475- nest : {
476- type : Options . name ,
477- name : ScalarTypes . String ,
478- } ,
450+ args : [
451+ {
452+ args : [ ] ,
453+ data : { type : Value . ListValue } ,
454+ directives : [ ] ,
455+ interfaces : [ ] ,
456+ name : Value . ListValue ,
457+ type : { fieldType : { name : Value . ListValue , type : Options . name } } ,
479458 } ,
480- } ,
481- data : {
482- type : ValueDefinition . InputValueDefinition ,
483- } ,
484- directives : [ ] ,
459+ ] ,
485460 interfaces : [ ] ,
486- args : [ ] ,
487461 } ,
462+
488463 {
489464 name : 'age' ,
490465 type : {
@@ -584,6 +559,113 @@ describe('Input Values tests on parser', () => {
584559 } ;
585560 expect ( tree . nodes ) . toEqual ( expect . arrayContaining ( treeMock . nodes ) ) ;
586561 } ) ;
562+ test ( `Default ScalarTypes values - ${ Object . keys ( ScalarTypes ) . join ( ', ' ) } ` , ( ) => {
563+ const schema = `input Person{
564+ names: [${ ScalarTypes . String } ] = ["Artur","A","B"]
565+ }` ;
566+ const tree = Parser . parse ( schema ) ;
567+ const treeMock : ParserTree = {
568+ nodes : [
569+ {
570+ name : 'Person' ,
571+ interfaces : [ ] ,
572+ type : {
573+ fieldType : {
574+ name : TypeDefinitionDisplayStrings . input ,
575+ type : Options . name ,
576+ } ,
577+ } ,
578+ data : {
579+ type : TypeDefinition . InputObjectTypeDefinition ,
580+ } ,
581+ directives : [ ] ,
582+ args : [
583+ {
584+ name : 'names' ,
585+ type : {
586+ fieldType : {
587+ type : Options . array ,
588+ nest : {
589+ name : ScalarTypes . String ,
590+ type : Options . name ,
591+ } ,
592+ } ,
593+ } ,
594+ data : {
595+ type : ValueDefinition . InputValueDefinition ,
596+ } ,
597+ directives : [ ] ,
598+ interfaces : [ ] ,
599+ args : [
600+ {
601+ name : Value . ListValue ,
602+ type : {
603+ fieldType : {
604+ name : Value . ListValue ,
605+ type : Options . name ,
606+ } ,
607+ } ,
608+ data : {
609+ type : Value . ListValue ,
610+ } ,
611+ directives : [ ] ,
612+ interfaces : [ ] ,
613+ args : [
614+ {
615+ name : 'Artur' ,
616+ interfaces : [ ] ,
617+ args : [ ] ,
618+ directives : [ ] ,
619+ type : {
620+ fieldType : {
621+ name : Value . StringValue ,
622+ type : Options . name ,
623+ } ,
624+ } ,
625+ data : {
626+ type : Value . StringValue ,
627+ } ,
628+ } ,
629+ {
630+ name : 'A' ,
631+ interfaces : [ ] ,
632+ args : [ ] ,
633+ directives : [ ] ,
634+ type : {
635+ fieldType : {
636+ name : Value . StringValue ,
637+ type : Options . name ,
638+ } ,
639+ } ,
640+ data : {
641+ type : Value . StringValue ,
642+ } ,
643+ } ,
644+ {
645+ name : 'B' ,
646+ interfaces : [ ] ,
647+ args : [ ] ,
648+ directives : [ ] ,
649+ type : {
650+ fieldType : {
651+ name : Value . StringValue ,
652+ type : Options . name ,
653+ } ,
654+ } ,
655+ data : {
656+ type : Value . StringValue ,
657+ } ,
658+ } ,
659+ ] ,
660+ } ,
661+ ] ,
662+ } ,
663+ ] ,
664+ } ,
665+ ] ,
666+ } ;
667+ expect ( tree . nodes ) . toEqual ( expect . arrayContaining ( treeMock . nodes ) ) ;
668+ } ) ;
587669
588670 test ( 'Default Input objects' , ( ) => {
589671 const schema = `
0 commit comments