aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/util_test.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-01-04 03:35:14 +0800
committerGitHub <noreply@github.com>2018-01-04 03:35:14 +0800
commitdc9d8b24c6fccd584975c5b9f25c8090b7e8051d (patch)
tree732806322abf5602a17533caf1d6a875a97e10a6 /test/unit/util_test.js
parentdfb22471087f040d8345a5a17321e1462842045c (diff)
parent099f078a3d73b2aed30dc5e1cd3a2facde58606a (diff)
downloadtangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.tar
tangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.tar.gz
tangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.tar.bz2
tangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.tar.lz
tangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.tar.xz
tangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.tar.zst
tangerine-wallet-browser-dc9d8b24c6fccd584975c5b9f25c8090b7e8051d.zip
Merge pull request #2845 from alextsg/NewUI-flat-4.0.5c
[NewUI] Merge master into NewUI-flat
Diffstat (limited to 'test/unit/util_test.js')
-rw-r--r--test/unit/util_test.js12
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 () {