1
1
import { expect } from 'chai' ;
2
2
import { describe , it } from 'mocha' ;
3
3
4
- import type { GraphQLArgument , GraphQLInputField } from '../definition' ;
4
+ import type {
5
+ GraphQLArgument ,
6
+ GraphQLInputField ,
7
+ GraphQLInputType ,
8
+ } from '../definition' ;
5
9
import {
6
10
GraphQLDirective ,
7
11
GraphQLSkipDirective ,
@@ -503,7 +507,7 @@ describe('Type predicates', () => {
503
507
504
508
describe ( 'getNullableType' , ( ) => {
505
509
it ( 'returns undefined for no type' , ( ) => {
506
- expect ( getNullableType ( ) ) . to . equal ( undefined ) ;
510
+ expect ( getNullableType ( undefined ) ) . to . equal ( undefined ) ;
507
511
expect ( getNullableType ( null ) ) . to . equal ( undefined ) ;
508
512
} ) ;
509
513
@@ -536,7 +540,7 @@ describe('Type predicates', () => {
536
540
537
541
describe ( 'getNamedType' , ( ) => {
538
542
it ( 'returns undefined for no type' , ( ) => {
539
- expect ( getNamedType ( ) ) . to . equal ( undefined ) ;
543
+ expect ( getNamedType ( undefined ) ) . to . equal ( undefined ) ;
540
544
expect ( getNamedType ( null ) ) . to . equal ( undefined ) ;
541
545
} ) ;
542
546
@@ -559,15 +563,18 @@ describe('Type predicates', () => {
559
563
} ) ;
560
564
561
565
describe ( 'isRequiredArgument' , ( ) => {
562
- function buildArg ( config : $Shape < GraphQLArgument > ) : GraphQLArgument {
566
+ function buildArg ( config : { |
567
+ type : GraphQLInputType ,
568
+ defaultValue ?: mixed ,
569
+ | } ) : GraphQLArgument {
563
570
return {
564
571
name : 'someArg' ,
572
+ type : config . type ,
565
573
description : undefined ,
566
- defaultValue : undefined ,
574
+ defaultValue : config . defaultValue ,
567
575
deprecationReason : null ,
568
576
extensions : undefined ,
569
577
astNode : undefined ,
570
- ...config ,
571
578
} ;
572
579
}
573
580
@@ -604,17 +611,18 @@ describe('Type predicates', () => {
604
611
} ) ;
605
612
606
613
describe ( 'isRequiredInputField' , ( ) => {
607
- function buildInputField (
608
- config : $Shape < GraphQLInputField > ,
609
- ) : GraphQLInputField {
614
+ function buildInputField ( config : { |
615
+ type : GraphQLInputType ,
616
+ defaultValue ?: mixed ,
617
+ | } ) : GraphQLInputField {
610
618
return {
611
619
name : 'someInputField' ,
620
+ type : config . type ,
612
621
description : undefined ,
613
- defaultValue : undefined ,
622
+ defaultValue : config . defaultValue ,
614
623
deprecationReason : null ,
615
624
extensions : undefined ,
616
625
astNode : undefined ,
617
- ...config ,
618
626
} ;
619
627
}
620
628
0 commit comments