aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/util_test.js
diff options
context:
space:
mode:
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 () {