web3.js/test/web3.eth.getBalance.js

35 lines
885 B
JavaScript
Raw Normal View History

2015-03-24 05:50:42 +00:00
var BigNumber = require('bignumber.js');
2015-03-23 13:08:59 +00:00
var web3 = require('../index');
2015-03-24 05:50:42 +00:00
var testMethod = require('./helpers/test.method.js');
2015-03-23 13:08:59 +00:00
var method = 'getBalance';
var tests = [{
2015-03-23 16:02:34 +00:00
args: [301, 2],
formattedArgs: ['0x12d', '0x2'],
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 16:02:34 +00:00
},{
2015-03-23 13:08:59 +00:00
args: ['0x12d', '0x1'],
formattedArgs: ['0x12d', '0x1'],
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 13:23:45 +00:00
}, {
args: [0x12d, 0x1],
formattedArgs: ['0x12d', '0x1'],
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 13:23:45 +00:00
}, {
args: [0x12d],
2015-03-23 16:11:19 +00:00
formattedArgs: ['0x12d', web3.eth.defaultBlock],
2015-03-23 13:23:45 +00:00
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 13:08:59 +00:00
}];
2015-03-24 10:44:33 +00:00
testMethod.runTests('eth', method, tests);
2015-03-23 13:08:59 +00:00