aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/tests/send-utils.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/send/tests/send-utils.test.js')
-rw-r--r--ui/app/components/send/tests/send-utils.test.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/ui/app/components/send/tests/send-utils.test.js b/ui/app/components/send/tests/send-utils.test.js
index b8579e0e4..18dde495a 100644
--- a/ui/app/components/send/tests/send-utils.test.js
+++ b/ui/app/components/send/tests/send-utils.test.js
@@ -58,6 +58,7 @@ const {
calcTokenBalance,
isBalanceSufficient,
isTokenBalanceSufficient,
+ removeLeadingZeroes,
} = sendUtils
describe('send utils', () => {
@@ -483,4 +484,29 @@ describe('send utils', () => {
assert.equal(getToAddressForGasUpdate(undefined, 'B'), 'b')
})
})
+
+ describe('removeLeadingZeroes()', () => {
+ it('should remove leading zeroes from int when user types', () => {
+ assert.equal(removeLeadingZeroes('0'), '0')
+ assert.equal(removeLeadingZeroes('1'), '1')
+ assert.equal(removeLeadingZeroes('00'), '0')
+ assert.equal(removeLeadingZeroes('01'), '1')
+ })
+
+ it('should remove leading zeroes from int when user copy/paste', () => {
+ assert.equal(removeLeadingZeroes('001'), '1')
+ })
+
+ it('should remove leading zeroes from float when user types', () => {
+ assert.equal(removeLeadingZeroes('0.'), '0.')
+ assert.equal(removeLeadingZeroes('0.0'), '0.0')
+ assert.equal(removeLeadingZeroes('0.00'), '0.00')
+ assert.equal(removeLeadingZeroes('0.001'), '0.001')
+ assert.equal(removeLeadingZeroes('0.10'), '0.10')
+ })
+
+ it('should remove leading zeroes from float when user copy/paste', () => {
+ assert.equal(removeLeadingZeroes('00.1'), '0.1')
+ })
+ })
})