web3.js/test/utils.isFunction.js

22 lines
589 B
JavaScript
Raw Normal View History

2015-03-08 09:07:32 +00:00
var chai = require('chai');
2015-03-08 17:18:52 +00:00
var utils = require('../lib/utils/utils.js');
2015-03-08 09:07:32 +00:00
var assert = chai.assert;
var tests = [
{ func: function () {}, is: true},
{ func: new Function(), is: true},
{ func: 'function', is: false},
{ func: {}, is: false}
];
2015-03-25 21:17:35 +00:00
describe('lib/utils/utils', function () {
2015-03-08 09:07:32 +00:00
describe('isFunction', function () {
tests.forEach(function (test) {
it('shoud test if value ' + test.func + ' is function: ' + test.is, function () {
assert.equal(utils.isFunction(test.func), test.is);
});
});
});
});