@@ -51,16 +51,16 @@ describe('updateById() ->', () => {
5151 } ) ;
5252
5353 describe ( 'Resolver.args' , ( ) => {
54- it ( 'should have `input ` arg' , ( ) => {
54+ it ( 'should have `record ` arg' , ( ) => {
5555 const resolver = updateById ( UserModel , UserTypeComposer ) ;
56- const argConfig = resolver . getArg ( 'input ' ) ;
56+ const argConfig = resolver . getArg ( 'record ' ) ;
5757 expect ( argConfig ) . property ( 'type' ) . instanceof ( GraphQLNonNull ) ;
5858 expect ( argConfig ) . deep . property ( 'type.ofType.name' , 'UpdateByIdUserInput' ) ;
5959 } ) ;
6060
61- it ( 'should have `input ._id` required arg' , ( ) => {
61+ it ( 'should have `record ._id` required arg' , ( ) => {
6262 const resolver = updateById ( UserModel , UserTypeComposer ) ;
63- const argConfig = resolver . getArg ( 'input ' ) || { } ;
63+ const argConfig = resolver . getArg ( 'record ' ) || { } ;
6464 expect ( argConfig ) . deep . property ( 'type.ofType' ) . instanceof ( GraphQLInputObjectType ) ;
6565 if ( argConfig . type && argConfig . type . ofType ) {
6666 const _idFieldType = new InputTypeComposer ( argConfig . type . ofType ) . getFieldType ( '_id' ) ;
@@ -77,34 +77,34 @@ describe('updateById() ->', () => {
7777 result . catch ( ( ) => 'catch error if appear, hide it from mocha' ) ;
7878 } ) ;
7979
80- it ( 'should rejected with Error if args.input ._id is empty' , async ( ) => {
81- const result = updateById ( UserModel , UserTypeComposer ) . resolve ( { args : { input : { } } } ) ;
82- await expect ( result ) . be . rejectedWith ( Error , 'requires args.input ._id' ) ;
80+ it ( 'should rejected with Error if args.record ._id is empty' , async ( ) => {
81+ const result = updateById ( UserModel , UserTypeComposer ) . resolve ( { args : { record : { } } } ) ;
82+ await expect ( result ) . be . rejectedWith ( Error , 'requires args.record ._id' ) ;
8383 } ) ;
8484
8585 it ( 'should return payload.recordId' , async ( ) => {
8686 const result = await updateById ( UserModel , UserTypeComposer ) . resolve ( {
8787 args : {
88- input : { _id : user1 . id , name : 'some name' } ,
88+ record : { _id : user1 . id , name : 'some name' } ,
8989 } ,
9090 } ) ;
9191 expect ( result ) . have . property ( 'recordId' , user1 . id ) ;
9292 } ) ;
9393
94- it ( 'should change data via args.input in model' , async ( ) => {
94+ it ( 'should change data via args.record in model' , async ( ) => {
9595 const result = await updateById ( UserModel , UserTypeComposer ) . resolve ( {
9696 args : {
97- input : { _id : user1 . id , name : 'newName' } ,
97+ record : { _id : user1 . id , name : 'newName' } ,
9898 } ,
9999 } ) ;
100100 expect ( result ) . have . deep . property ( 'record.name' , 'newName' ) ;
101101 } ) ;
102102
103- it ( 'should change data via args.input in database' , ( done ) => {
103+ it ( 'should change data via args.record in database' , ( done ) => {
104104 const checkedName = 'nameForMongoDB' ;
105105 updateById ( UserModel , UserTypeComposer ) . resolve ( {
106106 args : {
107- input : { _id : user1 . id , name : checkedName } ,
107+ record : { _id : user1 . id , name : checkedName } ,
108108 } ,
109109 } ) . then ( ( ) => {
110110 UserModel . collection . findOne ( { _id : user1 . _id } , ( err , doc ) => {
@@ -118,7 +118,7 @@ describe('updateById() ->', () => {
118118 const checkedName = 'anyName123' ;
119119 const result = await updateById ( UserModel , UserTypeComposer ) . resolve ( {
120120 args : {
121- input : { _id : user1 . id , name : checkedName } ,
121+ record : { _id : user1 . id , name : checkedName } ,
122122 } ,
123123 } ) ;
124124 expect ( result ) . have . deep . property ( 'record.id' , user1 . id ) ;
0 commit comments