File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -115,17 +115,19 @@ describe('Graphql', () => {
115115 you : types . boolean ,
116116 } ,
117117 } ) ,
118+ body : types . fn ( [ 'b_Int' ] , types . boolean ) . include ( 'c_Boolean' ) ,
118119 } ) ;
119120
120- expect ( tpl ( { a_Int : 3 } ) . query ) . to . equal (
121- `query Hello ($a: Int) {
121+ expect ( tpl ( { a_Int : 3 , b_Int : 3 , c_Boolean : true } ) . query ) . to . equal (
122+ `query Hello ($a: Int, $b: Int, $c: Boolean ) {
122123 hello
123124 hi (a: $a) {
124125 how
125126 are {
126127 you
127128 }
128129 }
130+ body (b: $b) @include(if: $c)
129131}`
130132 ) ;
131133 } ) ;
@@ -589,6 +591,20 @@ fragment AdminFragment on Admin {
589591 id
590592 }
591593 }
594+ }`
595+ ) ;
596+ } ) ;
597+
598+ it ( 'template with custom name' , ( ) => {
599+ const tpl = graphql . mutation ( {
600+ id : types . number ,
601+ } , {
602+ name : 'CustomMutation' ,
603+ } ) ;
604+
605+ expect ( tpl . toString ( ) ) . to . equal (
606+ `mutation CustomMutation {
607+ id
592608}`
593609 ) ;
594610 } ) ;
You can’t perform that action at this time.
0 commit comments