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) {
56
56
}
57
57
58
58
if ( data . error ) {
59
- return reject ( data . error . message ) ;
59
+ return reject ( new Error ( data . error ) ) ;
60
60
}
61
-
62
61
resolve ( data ) ;
63
62
} ) . catch ( function ( error ) {
64
- return reject ( error ) ;
63
+ return reject ( new Error ( error ) ) ;
65
64
} ) ;
66
65
} ) ;
67
66
}
@@ -544,7 +543,7 @@ module.exports = function(apiKey, chain) {
544
543
let action = 'balance' ;
545
544
const tag = 'latest' ;
546
545
547
- if ( typeof address != 'string' && address . length ) {
546
+ if ( typeof address !== 'string' && address && address . length ) {
548
547
address = address . join ( ',' ) ;
549
548
action = 'balancemulti' ;
550
549
}
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