mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 10:30:04 +01:00
4f3fc95d50
* Use @metamask/eslint-config@1.1.0 * Use eslint-plugin-mocha@6.2.2 * Mark root ESLint config as root * Update Mocha ESLint rules with shared ESLint config
23 lines
602 B
JavaScript
23 lines
602 B
JavaScript
import assert from 'assert'
|
|
import { addCurrencies } from './conversion-util'
|
|
|
|
|
|
describe('conversion utils', function () {
|
|
describe('addCurrencies()', function () {
|
|
it('add whole numbers', function () {
|
|
const result = addCurrencies(3, 9)
|
|
assert.equal(result.toNumber(), 12)
|
|
})
|
|
|
|
it('add decimals', function () {
|
|
const result = addCurrencies(1.3, 1.9)
|
|
assert.equal(result.toNumber(), 3.2)
|
|
})
|
|
|
|
it('add repeating decimals', function () {
|
|
const result = addCurrencies(1 / 3, 1 / 9)
|
|
assert.equal(result.toNumber(), 0.4444444444444444)
|
|
})
|
|
})
|
|
})
|