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

65 lines
2.2 KiB
JavaScript
Raw Normal View History

2015-03-23 22:50:42 -07:00
var BigNumber = require('bignumber.js');
2015-03-23 06:08:59 -07:00
var web3 = require('../index');
2015-03-23 22:50:42 -07:00
var testMethod = require('./helpers/test.method.js');
2015-03-23 06:08:59 -07:00
var method = 'getBalance';
var tests = [{
2015-03-23 09:02:34 -07:00
args: [301, 2],
2015-04-02 04:08:40 -07:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'],
2015-03-23 09:02:34 -07:00
result: '0x31981',
2015-03-23 22:50:42 -07:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 09:27:14 -07:00
call: 'eth_'+ method
2015-03-23 09:02:34 -07:00
},{
2015-03-23 06:08:59 -07:00
args: ['0x12d', '0x1'],
2015-04-02 04:08:40 -07:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 06:08:59 -07:00
result: '0x31981',
2015-03-23 22:50:42 -07:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 09:27:14 -07:00
call: 'eth_'+ method
2015-03-23 06:23:45 -07:00
}, {
args: [0x12d, 0x1],
2015-04-02 04:08:40 -07:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 06:23:45 -07:00
result: '0x31981',
2015-03-23 22:50:42 -07:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 09:27:14 -07:00
call: 'eth_'+ method
2015-03-23 06:23:45 -07:00
}, {
args: [0x12d],
2015-04-02 04:08:40 -07:00
formattedArgs: ['0x000000000000000000000000000000000000012d', web3.eth.defaultBlock],
2015-03-23 06:23:45 -07:00
result: '0x31981',
2015-03-23 22:50:42 -07:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 09:27:14 -07:00
call: 'eth_'+ method
2015-03-29 12:54:53 -07:00
}, {
args: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 05:04:06 -07:00
}, {
args: ['dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-29 12:54:53 -07:00
}, {
args: ['1255171934823351805979544608257289442498956485798', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
}, {
args: ['1255171934823351805979544608257289442498956485798'],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 'latest'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 04:08:40 -07:00
}, {
args: ['0x00000000000000000000aaaaaaaaaaaaaaaaaaa'],
formattedArgs: ['0x000000000000000000000aaaaaaaaaaaaaaaaaaa', 'latest'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-23 06:08:59 -07:00
}];
2015-03-24 03:44:33 -07:00
testMethod.runTests('eth', method, tests);
2015-03-23 06:08:59 -07:00