Skip to content

Commit

Permalink
Add a few more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Apr 13, 2016
1 parent a51f9c7 commit 8b02ef4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ var Units = require('../')
describe('convert', function () {
it('should work for big unit to small unit', function () {
assert.equal(Units.convert('1', 'eth', 'wei'), '1000000000000000000')
assert.equal(Units.convert('20', 'gwei', 'wei'), '20000000000')
})
it('should work for small unit to big unit', function () {
assert.equal(Units.convert('1', 'wei', 'eth'), '0.000000000000000001')
assert.equal(Units.convert('1', 'finney', 'eth'), '0.001')
assert.equal(Units.convert('20', 'gwei', 'eth'), '0.00000002')
})
})

describe('lazyConvert', function () {
it('should work for big unit to small unit', function () {
assert.equal(Units.lazyConvert('1 eth', 'wei'), '1000000000000000000 wei')
assert.equal(Units.lazyConvert('20 gwei', 'wei'), '20000000000 wei')
})
it('should work for small unit to big unit', function () {
assert.equal(Units.lazyConvert('1 wei', 'eth'), '0.000000000000000001 eth')
assert.equal(Units.lazyConvert('1 finney', 'eth'), '0.001 eth')
assert.equal(Units.lazyConvert('20 gwei', 'eth'), '0.00000002 eth')
})
})

Expand Down

0 comments on commit 8b02ef4

Please sign in to comment.