web3.js/test/utils.fromWei.js

22 lines
1.2 KiB
JavaScript
Raw Normal View History

var assert = require('assert');
var utils = require('../lib/utils.js');
describe('utils', function () {
describe('toWei', function () {
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');
});
});
});