File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -56,12 +56,11 @@ module.exports = function(apiKey, chain) {
5656 }
5757
5858 if ( data . error ) {
59- return reject ( data . error . message ) ;
59+ return reject ( new Error ( data . error ) ) ;
6060 }
61-
6261 resolve ( data ) ;
6362 } ) . catch ( function ( error ) {
64- return reject ( error ) ;
63+ return reject ( new Error ( error ) ) ;
6564 } ) ;
6665 } ) ;
6766 }
@@ -544,7 +543,7 @@ module.exports = function(apiKey, chain) {
544543 let action = 'balance' ;
545544 const tag = 'latest' ;
546545
547- if ( typeof address != 'string' && address . length ) {
546+ if ( typeof address !== 'string' && address && address . length ) {
548547 address = address . join ( ',' ) ;
549548 action = 'balancemulti' ;
550549 }
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const assert = require ( 'chai' ) . assert ;
3+ const init = require ( '../.' ) . init ;
4+ describe ( 'balance' , function ( ) {
5+
6+ it ( 'no param sends a error' , function ( done ) {
7+ var api = init ( ) ;
8+ var balance = api . account . balance ( ) ;
9+ balance . catch ( function ( err ) {
10+ assert . ok ( err ) ;
11+ done ( ) ;
12+ } ) ;
13+ } ) ;
14+ } ) ;
You can’t perform that action at this time.
0 commit comments