11import { expect } from 'chai' ;
22import { describe , it } from 'mocha' ;
33
4- import type { GraphQLArgument , GraphQLInputField } from '../definition' ;
4+ import type {
5+ GraphQLArgument ,
6+ GraphQLInputField ,
7+ GraphQLInputType ,
8+ } from '../definition' ;
59import {
610 GraphQLDirective ,
711 GraphQLSkipDirective ,
@@ -503,7 +507,7 @@ describe('Type predicates', () => {
503507
504508 describe ( 'getNullableType' , ( ) => {
505509 it ( 'returns undefined for no type' , ( ) => {
506- expect ( getNullableType ( ) ) . to . equal ( undefined ) ;
510+ expect ( getNullableType ( undefined ) ) . to . equal ( undefined ) ;
507511 expect ( getNullableType ( null ) ) . to . equal ( undefined ) ;
508512 } ) ;
509513
@@ -536,7 +540,7 @@ describe('Type predicates', () => {
536540
537541 describe ( 'getNamedType' , ( ) => {
538542 it ( 'returns undefined for no type' , ( ) => {
539- expect ( getNamedType ( ) ) . to . equal ( undefined ) ;
543+ expect ( getNamedType ( undefined ) ) . to . equal ( undefined ) ;
540544 expect ( getNamedType ( null ) ) . to . equal ( undefined ) ;
541545 } ) ;
542546
@@ -559,15 +563,18 @@ describe('Type predicates', () => {
559563 } ) ;
560564
561565 describe ( 'isRequiredArgument' , ( ) => {
562- function buildArg ( config : $Shape < GraphQLArgument > ) : GraphQLArgument {
566+ function buildArg ( config : { |
567+ type : GraphQLInputType ,
568+ defaultValue ?: mixed ,
569+ | } ) : GraphQLArgument {
563570 return {
564571 name : 'someArg' ,
572+ type : config . type ,
565573 description : undefined ,
566- defaultValue : undefined ,
574+ defaultValue : config . defaultValue ,
567575 deprecationReason : null ,
568576 extensions : undefined ,
569577 astNode : undefined ,
570- ...config ,
571578 } ;
572579 }
573580
@@ -604,17 +611,18 @@ describe('Type predicates', () => {
604611 } ) ;
605612
606613 describe ( 'isRequiredInputField' , ( ) => {
607- function buildInputField (
608- config : $Shape < GraphQLInputField > ,
609- ) : GraphQLInputField {
614+ function buildInputField ( config : { |
615+ type : GraphQLInputType ,
616+ defaultValue ?: mixed ,
617+ | } ) : GraphQLInputField {
610618 return {
611619 name : 'someInputField' ,
620+ type : config . type ,
612621 description : undefined ,
613- defaultValue : undefined ,
622+ defaultValue : config . defaultValue ,
614623 deprecationReason : null ,
615624 extensions : undefined ,
616625 astNode : undefined ,
617- ...config ,
618626 } ;
619627 }
620628
0 commit comments