diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-08-28 06:02:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-28 06:02:07 +0800 |
commit | 4b17ec67ecd7c16b942fc49aedb8e53732adbb96 (patch) | |
tree | a75112b245f8ad7677cd2be425b13738e0e2f869 /ui/app/components/currency-display/tests/currency-display.container.test.js | |
parent | 30e49b8545a33faf2f1d1451c9135c996a6816b0 (diff) | |
parent | 952edf695c167385e9d864c45bd889219c456e78 (diff) | |
download | tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.gz tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.zst tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.zip |
Merge pull request #4919 from MetaMask/refactor-tx-list
Refactor and Redesign Transaction List
Diffstat (limited to 'ui/app/components/currency-display/tests/currency-display.container.test.js')
-rw-r--r-- | ui/app/components/currency-display/tests/currency-display.container.test.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ui/app/components/currency-display/tests/currency-display.container.test.js b/ui/app/components/currency-display/tests/currency-display.container.test.js new file mode 100644 index 000000000..474ce5378 --- /dev/null +++ b/ui/app/components/currency-display/tests/currency-display.container.test.js @@ -0,0 +1,61 @@ +import assert from 'assert' +import proxyquire from 'proxyquire' + +let mapStateToProps + +proxyquire('../currency-display.container.js', { + 'react-redux': { + connect: ms => { + mapStateToProps = ms + return () => ({}) + }, + }, +}) + +describe('CurrencyDisplay container', () => { + describe('mapStateToProps()', () => { + it('should return the correct props', () => { + const mockState = { + metamask: { + conversionRate: 280.45, + currentCurrency: 'usd', + }, + } + + const tests = [ + { + props: { + value: '0x2386f26fc10000', + numberOfDecimals: 2, + currency: 'usd', + }, + result: { + displayValue: '$2.80 USD', + }, + }, + { + props: { + value: '0x2386f26fc10000', + }, + result: { + displayValue: '$2.80 USD', + }, + }, + { + props: { + value: '0x1193461d01595930', + currency: 'ETH', + numberOfDecimals: 3, + }, + result: { + displayValue: '1.266 ETH', + }, + }, + ] + + tests.forEach(({ props, result }) => { + assert.deepEqual(mapStateToProps(mockState, props), result) + }) + }) + }) +}) |