2015-01-11 16:54:36 +00:00
|
|
|
var assert = require('assert');
|
|
|
|
var web3 = require('../index.js');
|
2015-02-03 18:48:51 +00:00
|
|
|
var u = require('./test.utils.js');
|
2015-01-11 16:54:36 +00:00
|
|
|
|
|
|
|
describe('web3', function() {
|
|
|
|
describe('eth', function() {
|
2015-02-20 08:34:26 +00:00
|
|
|
u.methodExists(web3.eth, 'getBalance');
|
|
|
|
u.methodExists(web3.eth, 'getState');
|
|
|
|
u.methodExists(web3.eth, 'getStorage');
|
|
|
|
u.methodExists(web3.eth, 'getTransactionCount');
|
2015-02-25 10:01:58 +00:00
|
|
|
u.methodExists(web3.eth, 'getData');
|
2015-02-20 08:34:26 +00:00
|
|
|
u.methodExists(web3.eth, 'sendTransaction');
|
2015-01-15 10:38:21 +00:00
|
|
|
u.methodExists(web3.eth, 'call');
|
2015-02-20 08:34:26 +00:00
|
|
|
u.methodExists(web3.eth, 'getBlock');
|
|
|
|
u.methodExists(web3.eth, 'getTransaction');
|
|
|
|
u.methodExists(web3.eth, 'getUncle');
|
|
|
|
u.methodExists(web3.eth, 'getCompilers');
|
|
|
|
u.methodExists(web3.eth.compile, 'lll');
|
|
|
|
u.methodExists(web3.eth.compile, 'solidity');
|
|
|
|
u.methodExists(web3.eth.compile, 'serpent');
|
|
|
|
u.methodExists(web3.eth, 'getBlockTransactionCount');
|
|
|
|
u.methodExists(web3.eth, 'getBlockUncleCount');
|
2015-02-23 17:30:37 +00:00
|
|
|
u.methodExists(web3.eth, 'filter');
|
|
|
|
u.methodExists(web3.eth, 'contract');
|
2015-01-11 16:54:36 +00:00
|
|
|
|
2015-01-15 10:38:21 +00:00
|
|
|
u.propertyExists(web3.eth, 'coinbase');
|
|
|
|
u.propertyExists(web3.eth, 'listening');
|
|
|
|
u.propertyExists(web3.eth, 'mining');
|
|
|
|
u.propertyExists(web3.eth, 'gasPrice');
|
|
|
|
u.propertyExists(web3.eth, 'accounts');
|
|
|
|
u.propertyExists(web3.eth, 'peerCount');
|
|
|
|
u.propertyExists(web3.eth, 'defaultBlock');
|
2015-02-20 08:34:26 +00:00
|
|
|
u.propertyExists(web3.eth, 'blockNumber');
|
2015-01-11 16:54:36 +00:00
|
|
|
});
|
2015-03-06 19:58:23 +00:00
|
|
|
|
|
|
|
// Fail at the moment
|
|
|
|
// describe('eth', function(){
|
|
|
|
// it('should be a positive balance', function() {
|
|
|
|
// // when
|
|
|
|
// var testAddress = '0x50f4ed0e83f9da907017bcfb444e3e25407f59bb';
|
|
|
|
// var balance = web3.eth.balanceAt(testAddress);
|
|
|
|
// // then
|
|
|
|
// assert(balance > 0, 'Balance is ' + balance);
|
|
|
|
// });
|
|
|
|
|
|
|
|
// it('should return a block', function() {
|
|
|
|
// // when
|
|
|
|
// var block = web3.eth.block(0);
|
|
|
|
|
|
|
|
// // then
|
|
|
|
// assert.notEqual(block, null);
|
|
|
|
// assert.equal(block.number, 0);
|
|
|
|
// assert(web3.toDecimal(block.difficulty) > 0);
|
|
|
|
// });
|
|
|
|
// });
|
2015-01-11 16:54:36 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|