aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send.utils.test.js
diff options
context:
space:
mode:
authorАнна <anna@MacBook-Air-Anna.local>2018-07-05 11:15:28 +0800
committerАнна <anna@MacBook-Air-Anna.local>2018-07-05 11:15:28 +0800
commit90934bca46cf990554cbf9be9e302ab5e2fc8041 (patch)
treeee68fa3d98e8c0e072980fd07397b3a9bd40d640 /ui/app/components/send_/send.utils.test.js
parent1f6bf0a80d43252d7b84e8e0247a524b77569810 (diff)
parentfd218142acb6dab0b2f921b9729f17ff90cffc2d (diff)
downloadtangerine-wallet-browser-90934bca46cf990554cbf9be9e302ab5e2fc8041.tar.gz
tangerine-wallet-browser-90934bca46cf990554cbf9be9e302ab5e2fc8041.tar.zst
tangerine-wallet-browser-90934bca46cf990554cbf9be9e302ab5e2fc8041.zip
Merge branch 'develop' into to-autocomplete
Diffstat (limited to 'ui/app/components/send_/send.utils.test.js')
-rw-r--r--ui/app/components/send_/send.utils.test.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/ui/app/components/send_/send.utils.test.js b/ui/app/components/send_/send.utils.test.js
new file mode 100644
index 000000000..36f3a5c10
--- /dev/null
+++ b/ui/app/components/send_/send.utils.test.js
@@ -0,0 +1,30 @@
+import assert from 'assert'
+import { removeLeadingZeroes } from './send.utils'
+
+
+describe('send utils', () => {
+ 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')
+ })
+ })
+})