1- import { TemplateUtils } from '@/TreeToGraphQL/templates/TemplateUtils ' ;
2- import { Options , ParserField , TypeSystemDefinition } from '../../Models' ;
1+ import { compileType , decompileType } from '@/shared ' ;
2+ import { FieldType , Options , ParserField , TypeSystemDefinition } from '../../Models' ;
33
44describe ( 'TemplateUtils tests on parser' , ( ) => {
55 test ( `ListType fields` , ( ) => {
@@ -25,7 +25,36 @@ describe('TemplateUtils tests on parser', () => {
2525 args : [ ] ,
2626 } ;
2727
28- const graphql = TemplateUtils . resolveFieldType ( treeMock . type . fieldType ) ;
28+ const graphql = compileType ( treeMock . type . fieldType ) ;
2929 expect ( graphql ) . toContain ( `[Person]!` ) ;
3030 } ) ;
31+ test ( `ListType fields 2` , ( ) => {
32+ const treeMock : FieldType = {
33+ type : Options . required ,
34+ nest : {
35+ type : Options . array ,
36+ nest : {
37+ type : Options . array ,
38+ nest : {
39+ type : Options . required ,
40+ nest : {
41+ type : Options . name ,
42+ name : 'Person' ,
43+ } ,
44+ } ,
45+ } ,
46+ } ,
47+ } ;
48+
49+ const graphql = compileType ( treeMock ) ;
50+ expect ( graphql ) . toContain ( `[[Person!]]!` ) ;
51+ } ) ;
52+ test ( `ListType fields 3` , ( ) => {
53+ const ft = decompileType ( `[[Person]!]!` ) ;
54+ expect ( compileType ( ft ) ) . toContain ( `[[Person]!]!` ) ;
55+ } ) ;
56+ test ( `ListType fields 4` , ( ) => {
57+ const ft = decompileType ( `[[Person]!]!` ) ;
58+ expect ( compileType ( ft ) ) . toContain ( `[[Person]!]!` ) ;
59+ } ) ;
3160} ) ;
0 commit comments