methodExists and propertyExists are now separated tests

This commit is contained in:
Marek Kotewicz 2015-01-15 11:38:21 +01:00
parent 472ad43211
commit bacc5aa6d3
5 changed files with 45 additions and 51 deletions

View File

@ -7,12 +7,10 @@ web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080'));
describe('web3', function() {
describe('db', function() {
it('should have all methods implemented', function() {
u.methodExists(web3.db, 'put');
u.methodExists(web3.db, 'get');
u.methodExists(web3.db, 'putString');
u.methodExists(web3.db, 'getString');
});
});
});

View File

@ -7,7 +7,6 @@ web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080'));
describe('web3', function() {
describe('eth', function() {
it('should have all methods implemented', function() {
u.methodExists(web3.eth, 'balanceAt');
u.methodExists(web3.eth, 'stateAt');
u.methodExists(web3.eth, 'storageAt');
@ -23,9 +22,7 @@ describe('web3', function() {
u.methodExists(web3.eth, 'solidity');
u.methodExists(web3.eth, 'serpent');
u.methodExists(web3.eth, 'logs');
});
it('should have all properties implemented', function () {
u.propertyExists(web3.eth, 'coinbase');
u.propertyExists(web3.eth, 'listening');
u.propertyExists(web3.eth, 'mining');
@ -37,6 +34,5 @@ describe('web3', function() {
u.propertyExists(web3.eth, 'number');
});
});
});

View File

@ -7,7 +7,6 @@ web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080'));
describe('web3', function() {
describe('shh', function() {
it('should have all methods implemented', function() {
u.methodExists(web3.shh, 'post');
u.methodExists(web3.shh, 'newIdentity');
u.methodExists(web3.shh, 'haveIdentity');
@ -15,5 +14,4 @@ describe('web3', function() {
u.methodExists(web3.shh, 'addToGroup');
});
});
});

View File

@ -1,11 +1,15 @@
var assert = require('assert');
var methodExists = function (object, method) {
it('should have method ' + method + ' implemented', function() {
assert.equal('function', typeof object[method], 'method ' + method + ' is not implemented');
});
};
var propertyExists = function (object, property) {
it('should have property ' + property + ' implemented', function() {
assert.equal('object', typeof object[property], 'property ' + property + ' is not implemented');
});
};
module.exports = {

View File

@ -6,7 +6,6 @@ var u = require('./utils.js');
web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider
describe('web3', function() {
it('should have all methods implemented', function() {
u.methodExists(web3, 'sha3');
u.methodExists(web3, 'toAscii');
u.methodExists(web3, 'fromAscii');
@ -14,5 +13,4 @@ describe('web3', function() {
u.methodExists(web3, 'fromFixed');
u.methodExists(web3, 'offset');
});
});