1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 16:18:07 +01:00
metamask-extension/ui/app/helpers/utils/conversion-util.test.js
Whymarrh Whitby 4f3fc95d50
Update ESLint rules for test suite (#8023)
* 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
2020-02-11 13:21:13 -03:30

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)
})
})
})