2015-02-20 11:40:09 +00:00
|
|
|
var assert = require('assert');
|
2015-03-08 17:18:52 +00:00
|
|
|
var utils = require('../lib/utils/utils.js');
|
2015-02-20 11:40:09 +00:00
|
|
|
|
|
|
|
describe('utils', function () {
|
2015-03-07 17:31:09 +00:00
|
|
|
describe('fromWei', function () {
|
2015-02-20 11:40:09 +00:00
|
|
|
it('should return the correct value', function () {
|
|
|
|
|
2015-02-23 09:01:00 +00:00
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'wei'), '1000000000000000000');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'kwei'), '1000000000000000');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'mwei'), '1000000000000');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'gwei'), '1000000000');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'szabo'), '1000000');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'finney'), '1000');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'ether'), '1');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'kether'), '0.001');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'grand'), '0.001');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'mether'), '0.000001');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'gether'), '0.000000001');
|
|
|
|
assert.equal(utils.fromWei(1000000000000000000, 'tether'), '0.000000000001');
|
2015-02-20 11:40:09 +00:00
|
|
|
});
|
|
|
|
});
|
2015-03-07 17:31:09 +00:00
|
|
|
});
|