From bacc5aa6d3dcaf464e19448341dcc8dfc17bcd84 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 15 Jan 2015 11:38:21 +0100 Subject: [PATCH] methodExists and propertyExists are now separated tests --- test/db.methods.js | 10 ++++----- test/eth.methods.js | 52 ++++++++++++++++++++------------------------ test/shh.methods.js | 12 +++++----- test/utils.js | 8 +++++-- test/web3.methods.js | 14 +++++------- 5 files changed, 45 insertions(+), 51 deletions(-) diff --git a/test/db.methods.js b/test/db.methods.js index b4abfc4d7..662f4e7cc 100644 --- a/test/db.methods.js +++ b/test/db.methods.js @@ -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'); - }); + u.methodExists(web3.db, 'put'); + u.methodExists(web3.db, 'get'); + u.methodExists(web3.db, 'putString'); + u.methodExists(web3.db, 'getString'); }); }); diff --git a/test/eth.methods.js b/test/eth.methods.js index 7190b27d2..892db0d8b 100644 --- a/test/eth.methods.js +++ b/test/eth.methods.js @@ -7,35 +7,31 @@ 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'); - u.methodExists(web3.eth, 'countAt'); - u.methodExists(web3.eth, 'codeAt'); - u.methodExists(web3.eth, 'transact'); - u.methodExists(web3.eth, 'call'); - u.methodExists(web3.eth, 'block'); - u.methodExists(web3.eth, 'transaction'); - u.methodExists(web3.eth, 'uncle'); - u.methodExists(web3.eth, 'compilers'); - u.methodExists(web3.eth, 'lll'); - u.methodExists(web3.eth, 'solidity'); - u.methodExists(web3.eth, 'serpent'); - u.methodExists(web3.eth, 'logs'); - }); + u.methodExists(web3.eth, 'balanceAt'); + u.methodExists(web3.eth, 'stateAt'); + u.methodExists(web3.eth, 'storageAt'); + u.methodExists(web3.eth, 'countAt'); + u.methodExists(web3.eth, 'codeAt'); + u.methodExists(web3.eth, 'transact'); + u.methodExists(web3.eth, 'call'); + u.methodExists(web3.eth, 'block'); + u.methodExists(web3.eth, 'transaction'); + u.methodExists(web3.eth, 'uncle'); + u.methodExists(web3.eth, 'compilers'); + u.methodExists(web3.eth, 'lll'); + 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'); - u.propertyExists(web3.eth, 'gasPrice'); - u.propertyExists(web3.eth, 'account'); - u.propertyExists(web3.eth, 'accounts'); - u.propertyExists(web3.eth, 'peerCount'); - u.propertyExists(web3.eth, 'defaultBlock'); - u.propertyExists(web3.eth, 'number'); - }); + u.propertyExists(web3.eth, 'coinbase'); + u.propertyExists(web3.eth, 'listening'); + u.propertyExists(web3.eth, 'mining'); + u.propertyExists(web3.eth, 'gasPrice'); + u.propertyExists(web3.eth, 'account'); + u.propertyExists(web3.eth, 'accounts'); + u.propertyExists(web3.eth, 'peerCount'); + u.propertyExists(web3.eth, 'defaultBlock'); + u.propertyExists(web3.eth, 'number'); }); }); diff --git a/test/shh.methods.js b/test/shh.methods.js index 08f573a3c..f2f56edbc 100644 --- a/test/shh.methods.js +++ b/test/shh.methods.js @@ -7,13 +7,11 @@ 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'); - u.methodExists(web3.shh, 'newGroup'); - u.methodExists(web3.shh, 'addToGroup'); - }); + u.methodExists(web3.shh, 'post'); + u.methodExists(web3.shh, 'newIdentity'); + u.methodExists(web3.shh, 'haveIdentity'); + u.methodExists(web3.shh, 'newGroup'); + u.methodExists(web3.shh, 'addToGroup'); }); }); diff --git a/test/utils.js b/test/utils.js index 4c508da67..8617348e4 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,11 +1,15 @@ var assert = require('assert'); var methodExists = function (object, method) { - assert.equal('function', typeof object[method], 'method ' + method + ' is not implemented'); + it('should have method ' + method + ' implemented', function() { + assert.equal('function', typeof object[method], 'method ' + method + ' is not implemented'); + }); }; var propertyExists = function (object, property) { - assert.equal('object', typeof object[property], 'property ' + property + ' is not implemented'); + it('should have property ' + property + ' implemented', function() { + assert.equal('object', typeof object[property], 'property ' + property + ' is not implemented'); + }); }; module.exports = { diff --git a/test/web3.methods.js b/test/web3.methods.js index a7e020978..5c30177e5 100644 --- a/test/web3.methods.js +++ b/test/web3.methods.js @@ -6,13 +6,11 @@ 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'); - u.methodExists(web3, 'toFixed'); - u.methodExists(web3, 'fromFixed'); - u.methodExists(web3, 'offset'); - }); + u.methodExists(web3, 'sha3'); + u.methodExists(web3, 'toAscii'); + u.methodExists(web3, 'fromAscii'); + u.methodExists(web3, 'toFixed'); + u.methodExists(web3, 'fromFixed'); + u.methodExists(web3, 'offset'); });