diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-19 13:58:46 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-19 13:58:46 +0800 |
commit | c8c773d6416f92c520a509a9811d73f68aa00fc0 (patch) | |
tree | 495a798eeb4a5272c80d93725f5146a6fbcf85c8 /test/unit/components | |
parent | 5bdee96e73f65a0b369277e9c56b0afe5159e65b (diff) | |
parent | de1da7d1b215ade650fc644adf63384a401dc240 (diff) | |
download | tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.gz tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.bz2 tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.lz tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.xz tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.zst tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.zip |
Merge branch 'NewUI-flat' into merge
Diffstat (limited to 'test/unit/components')
-rw-r--r-- | test/unit/components/balance-component-test.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/components/balance-component-test.js b/test/unit/components/balance-component-test.js new file mode 100644 index 000000000..c32a8ab2b --- /dev/null +++ b/test/unit/components/balance-component-test.js @@ -0,0 +1,32 @@ +var assert = require('assert') +var BalanceComponent = require('../../../ui/app/components/balance-component') + +describe('BalanceComponent', function () { + let balanceComponent + + beforeEach(function () { + balanceComponent = new BalanceComponent() + }) + + it('shows token balance and convert to fiat value based on conversion rate', function () { + const formattedBalance = '1.23 ETH' + + const tokenBalance = balanceComponent.getTokenBalance(formattedBalance, false) + const fiatDisplayNumber = balanceComponent.getFiatDisplayNumber(formattedBalance, 2) + + assert.equal('1.23 ETH', tokenBalance) + assert.equal(2.46, fiatDisplayNumber) + }) + + it('shows only the token balance when conversion rate is not available', function () { + const formattedBalance = '1.23 ETH' + + const tokenBalance = balanceComponent.getTokenBalance(formattedBalance, false) + const fiatDisplayNumber = balanceComponent.getFiatDisplayNumber(formattedBalance, 0) + + assert.equal('1.23 ETH', tokenBalance) + assert.equal('N/A', fiatDisplayNumber) + }) + +}) + |