diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2017-12-29 06:55:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-29 06:55:42 +0800 |
commit | a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3 (patch) | |
tree | ee887e716a21f8418476981f852a661c06bbdd07 /test | |
parent | 06f496310ce7d719bbb5690f307db143ba57a1a7 (diff) | |
parent | c3d85c0a66676a15b598424e379610237243cb10 (diff) | |
download | tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.tar tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.tar.gz tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.tar.bz2 tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.tar.lz tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.tar.xz tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.tar.zst tangerine-wallet-browser-a22e98910d31ab1f79c0b23cb9b4c375ee0c84c3.zip |
Merge pull request #2818 from MetaMask/i2782-ethroundingerror
Fix rounding error in ether input on send screen
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/util_test.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/util_test.js b/test/unit/util_test.js index 3a8b6bdfd..59048975a 100644 --- a/test/unit/util_test.js +++ b/test/unit/util_test.js @@ -201,6 +201,18 @@ describe('util', function () { var output = util.normalizeEthStringToWei(input) assert.equal(output.toString(10), ethInWei) }) + + it('should account for overflow numbers gracefully by dropping extra precision.', function () { + var input = '1.11111111111111111111' + var output = util.normalizeEthStringToWei(input) + assert.equal(output.toString(10), '1111111111111111111') + }) + + it('should not truncate very exact wei values that do not have extra precision.', function () { + var input = '1.100000000000000001' + var output = util.normalizeEthStringToWei(input) + assert.equal(output.toString(10), '1100000000000000001') + }) }) describe('#normalizeNumberToWei', function () { |