File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ Wallet.prototype.transfers = function(params, callback) {
207207  } 
208208
209209  if  ( params . address )  { 
210-     if  ( ! _ . isArray ( params . address )  ||  ! _ . isString )  { 
210+     if  ( ! _ . isArray ( params . address )  &&  ! _ . isString ( params . address ) )  { 
211211      throw  new  Error ( 'invalid address argument, expecting string or array' ) ; 
212212    } 
213213    if  ( _ . isArray ( params . address ) )  { 
Original file line number Diff line number Diff line change @@ -98,6 +98,32 @@ describe('V2 Wallet:', function() {
9898      scope . isDone ( ) . should . be . True ( ) ; 
9999    } ) ) ; 
100100
101+     it ( 'should accept a string argument for address' ,  co ( function  * ( )  { 
102+       const  params  =  { 
103+         limit : 1 , 
104+         address : 'stringAddress' 
105+       } ; 
106+ 
107+       const  apiParams  =  { 
108+         limit : '1' , 
109+         address : 'stringAddress' 
110+       } ; 
111+ 
112+       const  scope  = 
113+         nock ( bgUrl ) 
114+         . get ( `/api/v2/${ wallet . coin ( ) } ${ wallet . id ( ) }  ) 
115+         . query ( _ . matches ( apiParams ) ) 
116+         . reply ( 200 ) ; 
117+ 
118+       try  { 
119+         yield  wallet . transfers ( params ) ; 
120+       }  catch  ( e )  { 
121+         // test is successful if nock is consumed, HMAC errors expected 
122+       } 
123+ 
124+       scope . isDone ( ) . should . be . True ( ) ; 
125+     } ) ) ; 
126+ 
101127    it ( 'should throw errors for invalid expected parameters' ,  co ( function  * ( )  { 
102128      ( ( )  =>  wallet . transfers ( {  address : 13375  } ) ) . should . throw ( 'invalid address argument, expecting string or array' ) ; 
103129
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments