@@ -612,6 +612,56 @@ describe('Stub', () => {
612612            } ) ; 
613613        } ) ; 
614614
615+         describe . only ( 'getMultipleStates' ,  ( )  =>  { 
616+             it ( 'should return handler.handleGetMultipleStates results' ,  async  ( )  =>  { 
617+                 const  handleGetMultipleStatesStub  =  sinon . stub ( ) . resolves ( [ 'value1' ,  'value2' ,  'value3' ] ) ; 
618+ 
619+                 const  stub  =  new  Stub ( { 
620+                     handleGetMultipleStates : handleGetMultipleStatesStub 
621+                 } ,  'dummyChannelId' ,  'dummyTxid' ,  chaincodeInput ) ; 
622+ 
623+                 const  result  =  await  stub . getMultipleStates ( 'key1' ,  'key2' ,  'key3' ) ; 
624+                 expect ( result ) . to . deep . equal ( [ 'value1' ,  'value2' ,  'value3' ] ) ; 
625+                 
626+                 expect ( handleGetMultipleStatesStub . calledOnce ) . to . be . true ; 
627+                 expect ( handleGetMultipleStatesStub . firstCall . args ) . to . deep . equal ( [ 
628+                     '' , 
629+                     [ 'key1' ,  'key2' ,  'key3' ] , 
630+                     'dummyChannelId' , 
631+                     'dummyTxid' 
632+                 ] ) ; 
633+             } ) ; 
634+ 
635+             it ( 'should return empty array if no keys passed' ,  async  ( )  =>  { 
636+                 const  handleGetMultipleStatesStub  =  sinon . stub ( ) . resolves ( [ ] ) ; 
637+ 
638+                 const  stub  =  new  Stub ( { 
639+                     handleGetMultipleStates : handleGetMultipleStatesStub 
640+                 } ,  'dummyChannelId' ,  'dummyTxid' ,  chaincodeInput ) ; 
641+ 
642+                 const  result  =  await  stub . getMultipleStates ( ) ; 
643+                 expect ( result ) . to . deep . equal ( [ ] ) ; 
644+ 
645+                 expect ( handleGetMultipleStatesStub . calledOnce ) . to . be . true ; 
646+                 expect ( handleGetMultipleStatesStub . firstCall . args ) . to . deep . equal ( [ 
647+                     '' , 
648+                     [ ] , 
649+                     'dummyChannelId' , 
650+                     'dummyTxid' 
651+                 ] ) ; 
652+             } ) ; 
653+ 
654+             it ( 'should throw error if handler rejects' ,  async  ( )  =>  { 
655+                 const  handleGetMultipleStatesStub  =  sinon . stub ( ) . rejects ( new  Error ( 'Something gone wrong' ) ) ; 
656+ 
657+                 const  stub  =  new  Stub ( { 
658+                     handleGetMultipleStates : handleGetMultipleStatesStub 
659+                 } ,  'dummyChannelId' ,  'dummyTxid' ,  chaincodeInput ) ; 
660+ 
661+                 await  expect ( stub . getMultipleStates ( 'key1' ) ) . to . be . rejectedWith ( 'Something gone wrong' ) ; 
662+             } ) ; 
663+         } ) ; 
664+ 
615665        describe ( 'putState' ,  ( )  =>  { 
616666            it  ( 'should return handler.handlePutState' ,  async  ( )  =>  { 
617667                const  handlePutStateStub  =  sinon . stub ( ) . resolves ( 'some state' ) ; 
0 commit comments