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

65 lines
2.2 KiB
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],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'],
2015-03-23 16:02:34 +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 16:02:34 +00:00
},{
2015-03-23 13:08:59 +00:00
args: ['0x12d', '0x1'],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 13:08:59 +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:23:45 +00:00
}, {
args: [0x12d, 0x1],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
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:23:45 +00:00
}, {
args: [0x12d],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', 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-29 19:54:53 +00:00
}, {
args: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 12:04:06 +00:00
}, {
args: ['dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-29 19:54:53 +00: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 11:08:40 +00:00
}, {
args: ['0x00000000000000000000aaaaaaaaaaaaaaaaaaa'],
formattedArgs: ['0x000000000000000000000aaaaaaaaaaaaaaaaaaa', 'latest'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
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