A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/ui/app/conversion-util.test.js

24 lines
567 B

import assert from 'assert'
import {addCurrencies} from './conversion-util'
describe('conversion utils', () => {
6 years ago
describe('addCurrencies()', () => {
it('add whole numbers', () => {
const result = addCurrencies(3, 5)
assert.equal(result.toNumber(), 8)
})
it('add decimals', () => {
const result = addCurrencies(1.3, 1.5)
assert.equal(result.toNumber(), 2.8)
})
it('add repeating decimals', () => {
const result = addCurrencies(1/3, 1/7)
assert.equal(result.toNumber(), 0.47619047619047616)
})
})
})