commit
3837c2ddd7
File diff suppressed because it is too large
Load Diff
@ -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') |
||||
}) |
||||
}) |
||||
}) |
@ -0,0 +1,22 @@ |
||||
import assert from 'assert' |
||||
import {addCurrencies} from './conversion-util' |
||||
|
||||
|
||||
describe('conversion utils', () => { |
||||
describe('addCurrencies()', () => { |
||||
it('add whole numbers', () => { |
||||
const result = addCurrencies(3, 9) |
||||
assert.equal(result.toNumber(), 12) |
||||
}) |
||||
|
||||
it('add decimals', () => { |
||||
const result = addCurrencies(1.3, 1.9) |
||||
assert.equal(result.toNumber(), 3.2) |
||||
}) |
||||
|
||||
it('add repeating decimals', () => { |
||||
const result = addCurrencies(1 / 3, 1 / 9) |
||||
assert.equal(result.toNumber(), 0.4444444444444444) |
||||
}) |
||||
}) |
||||
}) |
Loading…
Reference in new issue