solidity/web3.eth.gasPrice.js
Marek Kotewicz 1efd3c2687 Squashed 'libjsqrc/ethereumjs/' changes from 73b9ed2..4def095
4def095 updated README.md
15b4dbd updated bower && package.json files
0ccc05a web3 in global namespace
ccc59d1 version 0.2.6
9c2c946 Merge branch 'web3' into develop
6763f34 tests for creating new contract with nondefault constructor, added missing files
2ef5efc fixed #70, creating contract with nondefault constructor
dbe4015 Merge branch 'master' into develop
48b351a add gasPrice test and fixed failing uncle tests
7f75f3e fixed gasPrice output
ddec629 fixed getUncle parameter count
1e89ef0 changed to eth_protocolVersion
6add9bd Merge pull request #151 from ethereum/develop

git-subtree-dir: libjsqrc/ethereumjs
git-subtree-split: 4def0958d35cb5b8d92d277423af4d435dd89f16
2015-04-10 08:50:24 +02:00

40 lines
1.1 KiB
JavaScript

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);
});
});
});
});