mirror of https://github.com/status-im/web3.js.git
add gasPrice test and fixed failing uncle tests
This commit is contained in:
parent
7f75f3e64f
commit
48b351ae6f
|
@ -0,0 +1,39 @@
|
|||
var chai = require('chai');
|
||||
var assert = chai.assert;
|
||||
var web3 = require('../index');
|
||||
var BigNumber = require('bignumber.js');
|
||||
var FakeHttpProvider = require('./helpers/FakeHttpProvider');
|
||||
|
||||
var method = 'gasPrice';
|
||||
|
||||
var tests = [{
|
||||
result: '0x15f90',
|
||||
formattedResult: new BigNumber(90000),
|
||||
call: 'eth_'+ method
|
||||
}];
|
||||
|
||||
describe('web3.eth', function () {
|
||||
describe(method, function () {
|
||||
tests.forEach(function (test, index) {
|
||||
it('property test: ' + index, function () {
|
||||
|
||||
// given
|
||||
var provider = new FakeHttpProvider();
|
||||
web3.setProvider(provider);
|
||||
provider.injectResult(test.result);
|
||||
provider.injectValidation(function (payload) {
|
||||
assert.equal(payload.jsonrpc, '2.0');
|
||||
assert.equal(payload.method, test.call);
|
||||
assert.deepEqual(payload.params, []);
|
||||
});
|
||||
|
||||
// when
|
||||
var result = web3.eth[method];
|
||||
|
||||
// then
|
||||
assert.deepEqual(test.formattedResult, result);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -118,19 +118,19 @@ var formattedBlockResultWithTx = {
|
|||
|
||||
var tests = [{
|
||||
args: ['0x47d33b27bb249a2dbab4c0612bf9caf4c1950855', 2],
|
||||
formattedArgs: ['0x47d33b27bb249a2dbab4c0612bf9caf4c1950855', '0x2', false],
|
||||
formattedArgs: ['0x47d33b27bb249a2dbab4c0612bf9caf4c1950855', '0x2'],
|
||||
result: blockResult,
|
||||
formattedResult: formattedBlockResult,
|
||||
call: 'eth_getUncleByBlockHashAndIndex'
|
||||
},{
|
||||
args: [436, 1],
|
||||
formattedArgs: ['0x1b4', '0x1', false],
|
||||
formattedArgs: ['0x1b4', '0x1'],
|
||||
result: blockResult,
|
||||
formattedResult: formattedBlockResult,
|
||||
call: 'eth_getUncleByBlockNumberAndIndex'
|
||||
},{
|
||||
args: [436, 1, true],
|
||||
formattedArgs: ['0x1b4', '0x1', true],
|
||||
formattedArgs: ['0x1b4', '0x1'],
|
||||
result: blockResultWithTx,
|
||||
formattedResult: formattedBlockResultWithTx,
|
||||
call: 'eth_getUncleByBlockNumberAndIndex'
|
||||
|
|
Loading…
Reference in New Issue