diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-08-16 10:18:01 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-08-24 07:45:27 +0800 |
commit | da0df790472c816d933e9b697e4dab1a429740a3 (patch) | |
tree | aa29b66b2a8aa6f0bff0141664aef2a49ec0d291 /ui/app/components/transaction-action | |
parent | 6670bc0e09dacaf9a91031a348d1a551ed1e3987 (diff) | |
download | tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.tar tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.tar.gz tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.tar.bz2 tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.tar.lz tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.tar.xz tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.tar.zst tangerine-wallet-browser-da0df790472c816d933e9b697e4dab1a429740a3.zip |
Add CurrencyDisplay and TokenCurrencyDisplay components
Diffstat (limited to 'ui/app/components/transaction-action')
-rw-r--r-- | ui/app/components/transaction-action/tests/transaction-action.component.test.js | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/ui/app/components/transaction-action/tests/transaction-action.component.test.js b/ui/app/components/transaction-action/tests/transaction-action.component.test.js new file mode 100644 index 000000000..bba997c20 --- /dev/null +++ b/ui/app/components/transaction-action/tests/transaction-action.component.test.js @@ -0,0 +1,102 @@ +import React from 'react' +import assert from 'assert' +import { shallow } from 'enzyme' +import TransactionAction from '../transaction-action.component' + +describe('TransactionAction Component', () => { + const tOrDefault = key => key + + describe('Outgoing transaction', () => { + it('should render -- when methodData is still fetching', () => { + const methodData = { data: {}, done: false, error: null } + const transaction = { + id: 1, + status: 'confirmed', + submittedTime: 1534045442919, + time: 1534045440641, + txParams: { + from: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6', + gas: '0x5208', + gasPrice: '0x3b9aca00', + nonce: '0x96', + to: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706', + value: '0x2386f26fc10000', + }, + } + + const wrapper = shallow(<TransactionAction + methodData={methodData} + transaction={transaction} + className="transaction-action" + />, { context: { tOrDefault }}) + + assert.equal(wrapper.find('.transaction-action').length, 1) + assert.equal(wrapper.text(), '--') + }) + + it('should render Outgoing', () => { + const methodData = { data: {}, done: true, error: null } + const transaction = { + id: 1, + status: 'confirmed', + submittedTime: 1534045442919, + time: 1534045440641, + txParams: { + from: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6', + gas: '0x5208', + gasPrice: '0x3b9aca00', + nonce: '0x96', + to: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706', + value: '0x2386f26fc10000', + }, + } + + const wrapper = shallow(<TransactionAction + methodData={methodData} + transaction={transaction} + className="transaction-action" + />, { context: { tOrDefault }}) + + assert.equal(wrapper.find('.transaction-action').length, 1) + assert.equal(wrapper.text(), 'outgoing') + }) + + it('should render Approved', () => { + const methodData = { + data: { + name: 'Approve', + params: [ + { type: 'address' }, + { type: 'uint256' }, + ], + }, + done: true, + error: null, + } + const transaction = { + id: 1, + status: 'confirmed', + submittedTime: 1534045442919, + time: 1534045440641, + txParams: { + from: '0xc5ae6383e126f901dcb06131d97a88745bfa88d6', + gas: '0x5208', + gasPrice: '0x3b9aca00', + nonce: '0x96', + to: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706', + value: '0x2386f26fc10000', + data: '0x095ea7b300000000000000000000000050a9d56c2b8ba9a5c7f2c08c3d26e0499f23a7060000000000000000000000000000000000000000000000000000000000000003', + }, + } + + const wrapper = shallow(<TransactionAction + methodData={methodData} + transaction={transaction} + className="transaction-action" + />, { context: { tOrDefault }}) + + assert.equal(wrapper.find('.transaction-action').length, 1) + assert.equal(wrapper.text(), 'approve') + }) + }) +}) |