blob: 51dcd1ecea00dd74a3c423e3586e45fc46098cbd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import assert from 'assert'
import {addCurrencies} from './conversion-util'
describe('conversion utils', () => {
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)
})
})
})
|