web3.js/test/utils.toNumber.js

16 lines
574 B
JavaScript
Raw Normal View History

2017-03-02 16:20:39 +01:00
var assert = require('assert');
var utils = require('../packages/web3-utils');
describe('lib/utils/utils', function () {
2017-03-15 16:18:20 +01:00
describe('hexToNumberString', function () {
2017-03-02 16:20:39 +01:00
it('should return the correct value', function () {
2017-03-15 16:18:20 +01:00
assert.equal(utils.hexToNumberString("0x3e8"), 1000);
assert.equal(utils.hexToNumberString('0x1f0fe294a36'), 2134567897654);
2017-03-02 16:20:39 +01:00
// allow compatiblity
2017-03-15 16:18:20 +01:00
assert.equal(utils.hexToNumberString(100000), 100000);
assert.equal(utils.hexToNumberString('100000'), 100000);
2017-03-02 16:20:39 +01:00
});
});
});