aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.test.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-07-04 03:42:14 +0800
committerkumavis <aaron@kumavis.me>2018-07-04 03:42:14 +0800
commit77daed5c74aa3c1fdbf1d9c71f544928f47f3993 (patch)
tree4a614dbdfce84b452562dcabccffa53b8393e2b0 /ui/app/conversion-util.test.js
parent2b2cd87e2d6e93dadb3ddd20ebf854ab6f2d2382 (diff)
parente467eda4f720fa89141ded2e709566102402479b (diff)
downloadtangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.gz
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.bz2
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.lz
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.xz
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.zst
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'ui/app/conversion-util.test.js')
-rw-r--r--ui/app/conversion-util.test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/app/conversion-util.test.js b/ui/app/conversion-util.test.js
new file mode 100644
index 000000000..368ce3bba
--- /dev/null
+++ b/ui/app/conversion-util.test.js
@@ -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)
+ })
+ })
+})