solidity/web3.eth.hashRate.js
Marek Kotewicz 2958ad88f3 Squashed 'libjsqrc/ethereumjs/' changes from 3b799d1..e908439
e908439 version 0.3.6
091c8e5 Merge branch 'develop' into tcoulter
272837e cleaned up param.js
38a13bc removed unused functions from coder.js
8e3158f Merge pull request #196 from debris/new_abi
c6a57b3 cleanup and documentation
6e60e1f new solidity abi decoding
3f0d1c8 new abi proposal implementation of encoding
39d70e8 Merge pull request #195 from debris/fixed_abi
f963855 removed unused functions from abi.js
c59419e added new "dave" example
860ad2c fixed #194
22ca9b0 Merge branch 'develop' of https://github.com/ethereum/ethereum.js into develop
6739a1b "dave" example
08f3aae add optional nonce property to sendTransaction
2ca4240 Add error handling to synchronous methods (obligatory warning against using synchronous calls at all).
4690130 version 0.3.5
7949f6a Merge pull request #187 from debris/encoding
944c5cc removed unused test files
8a9c9c5 Merge branch 'develop' into encoding
330b0da more tests for encoding and decoding solidity params
b064eab Handle this error properly. For instance, without this, if we cannot connect to the RPC client, JSON won't be able to parse the result (there is none), in which case would cause a RuntimeException.
7989607 version 0.3.4
afb61d5 Merge branch 'master' into develop
97f6e7d build files again
539ef7b Merge pull request #186 from ethereum/eventFilterFix
ec0dc44 Merge pull request #188 from ethereum/develop
bd73ccc added eth_hashrate
baed4c8 fixed old encoding
e9ec708 fixed event from and toBlock

git-subtree-dir: libjsqrc/ethereumjs
git-subtree-split: e90843973f3ae554069347b61cb5b393091c34d1
2015-05-10 15:52:25 +02:00

39 lines
1.1 KiB
JavaScript

var chai = require('chai');
var assert = chai.assert;
var web3 = require('../index');
var FakeHttpProvider = require('./helpers/FakeHttpProvider');
var method = 'hashrate';
var tests = [{
result: '0x788a8',
formattedResult: 493736,
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.strictEqual(test.formattedResult, result);
});
});
});
});