@@ -356,6 +356,13 @@ describe('Validate: Variables are in allowed positions', () => {
356356 dog @include(if: $boolVar)
357357 }` ) ;
358358 } ) ;
359+
360+ it ( 'undefined in directive with default value with option' , ( ) => {
361+ expectValid ( `
362+ {
363+ dog @include(if: $x)
364+ }` ) ;
365+ } ) ;
359366 } ) ;
360367
361368 describe ( 'Fragment arguments are validated' , ( ) => {
@@ -373,12 +380,26 @@ describe('Validate: Variables are in allowed positions', () => {
373380 ` ) ;
374381 } ) ;
375382
383+ it ( 'Boolean => Boolean with default value' , ( ) => {
384+ expectValid ( `
385+ query Query($booleanArg: Boolean)
386+ {
387+ complicatedArgs {
388+ ...A(b: $booleanArg)
389+ }
390+ }
391+ fragment A($b: Boolean = true) on ComplicatedArgs {
392+ booleanArgField(booleanArg: $b)
393+ }
394+ ` ) ;
395+ } ) ;
396+
376397 it ( 'Boolean => Boolean!' , ( ) => {
377398 expectErrors ( `
378- query Query($fb : Boolean)
399+ query Query($ab : Boolean)
379400 {
380401 complicatedArgs {
381- ...A(b: $fb )
402+ ...A(b: $ab )
382403 }
383404 }
384405 fragment A($b: Boolean!) on ComplicatedArgs {
@@ -387,10 +408,10 @@ describe('Validate: Variables are in allowed positions', () => {
387408 ` ) . toDeepEqual ( [
388409 {
389410 message :
390- 'Variable "$booleanArg " of type "Boolean" used in position expecting type "Boolean!".' ,
411+ 'Variable "$ab " of type "Boolean" used in position expecting type "Boolean!".' ,
391412 locations : [
392413 { line : 2 , column : 21 } ,
393- { line : 4 , column : 47 } ,
414+ { line : 5 , column : 21 } ,
394415 ] ,
395416 } ,
396417 ] ) ;
@@ -412,7 +433,7 @@ describe('Validate: Variables are in allowed positions', () => {
412433 'Variable "$intVar" of type "Int" used in position expecting type "Int!".' ,
413434 locations : [
414435 { line : 2 , column : 21 } ,
415- { line : 4 , column : 47 } ,
436+ { line : 4 , column : 21 } ,
416437 ] ,
417438 } ,
418439 ] ) ;
0 commit comments