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 BigNumber = require('bignumber.js');
|
|
|
|
var assert = chai.assert;
|
|
|
|
|
|
|
|
var tests = [
|
|
|
|
{ value: function () {}, is: false},
|
|
|
|
{ value: new Function(), is: false},
|
|
|
|
{ value: 'function', is: false},
|
|
|
|
{ value: {}, is: false},
|
|
|
|
{ value: new String('hello'), is: false},
|
|
|
|
{ value: new BigNumber(0), is: true},
|
|
|
|
{ value: 132, is: false},
|
|
|
|
{ value: '0x12', is: false},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
2015-03-25 21:17:35 +00:00
|
|
|
describe('lib/utils/utils', function () {
|
2015-03-08 09:07:32 +00:00
|
|
|
describe('isBigNumber', function () {
|
|
|
|
tests.forEach(function (test) {
|
|
|
|
it('shoud test if value ' + test.func + ' is BigNumber: ' + test.is, function () {
|
|
|
|
assert.equal(utils.isBigNumber(test.value), test.is);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|