aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.test.js
diff options
context:
space:
mode:
authortrejgun <trejgun@gmail.com>2018-06-24 17:48:02 +0800
committertrejgun <trejgun@gmail.com>2018-06-24 17:48:02 +0800
commit5d034006e8a73c7d64dee22c856c3733643454f8 (patch)
tree903d3da4af5954a179f13e58006d3deecb4cb052 /ui/app/conversion-util.test.js
parent299abee666d7f8347e062afff4f2fae47c7f6968 (diff)
downloadtangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.tar
tangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.tar.gz
tangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.tar.bz2
tangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.tar.lz
tangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.tar.xz
tangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.tar.zst
tangerine-wallet-browser-5d034006e8a73c7d64dee22c856c3733643454f8.zip
fixes #4307 BigNumber casting issue
Diffstat (limited to 'ui/app/conversion-util.test.js')
-rw-r--r--ui/app/conversion-util.test.js23
1 files changed, 23 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..c37264855
--- /dev/null
+++ b/ui/app/conversion-util.test.js
@@ -0,0 +1,23 @@
+import assert from 'assert'
+import {addCurrencies} from './conversion-util'
+
+
+
+describe('conversion utils', () => {
+ describe.only('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)
+ })
+ })
+})