1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix lint warnings in the send/ directory.

This commit is contained in:
Dan 2018-07-02 22:01:57 -02:30 committed by Whymarrh Whitby
parent b3d78ed8a1
commit 2e0cbf210e
4 changed files with 28 additions and 32 deletions

View File

@ -1 +1 @@
export { default } from './currency-display.js' export { default } from './currency-display.js'

View File

@ -58,6 +58,7 @@ const {
calcTokenBalance, calcTokenBalance,
isBalanceSufficient, isBalanceSufficient,
isTokenBalanceSufficient, isTokenBalanceSufficient,
removeLeadingZeroes,
} = sendUtils } = sendUtils
describe('send utils', () => { describe('send utils', () => {
@ -483,4 +484,29 @@ describe('send utils', () => {
assert.equal(getToAddressForGasUpdate(undefined, 'B'), 'b') 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')
})
})
}) })

View File

@ -1 +1 @@
export { default } from './to-autocomplete.js' export { default } from './to-autocomplete.js'

View File

@ -1,30 +0,0 @@
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')
})
})
})