diff options
author | Erik Marks <25517051+rekmarks@users.noreply.github.com> | 2018-06-13 04:39:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-13 04:39:21 +0800 |
commit | bb201d7c4aec5c8bb72615aaf2880a806a2bd138 (patch) | |
tree | fb39d41db91c831202dc0b057231b77ed1308210 /ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js | |
parent | 6ba70a039af5139933747a1ffae070fe246f3501 (diff) | |
parent | 0740dd6a5b89defd5f5ba27fa38c7004243f0ce2 (diff) | |
download | tangerine-wallet-browser-bb201d7c4aec5c8bb72615aaf2880a806a2bd138.tar.gz tangerine-wallet-browser-bb201d7c4aec5c8bb72615aaf2880a806a2bd138.tar.zst tangerine-wallet-browser-bb201d7c4aec5c8bb72615aaf2880a806a2bd138.zip |
Merge branch 'develop' into stop-reload-on-network-change
Diffstat (limited to 'ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js')
-rw-r--r-- | ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js new file mode 100644 index 000000000..e4f05d708 --- /dev/null +++ b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js @@ -0,0 +1,65 @@ +import React from 'react' +import assert from 'assert' +import { shallow } from 'enzyme' +import sinon from 'sinon' +import SendGasRow from '../send-gas-row.component.js' + +import SendRowWrapper from '../../send-row-wrapper/send-row-wrapper.component' +import GasFeeDisplay from '../../../../send/gas-fee-display-v2' + +const propsMethodSpies = { + showCustomizeGasModal: sinon.spy(), +} + +describe('SendGasRow Component', function () { + let wrapper + + beforeEach(() => { + wrapper = shallow(<SendGasRow + conversionRate={20} + convertedCurrency={'mockConvertedCurrency'} + gasLoadingError={false} + gasTotal={'mockGasTotal'} + showCustomizeGasModal={propsMethodSpies.showCustomizeGasModal} + />, { context: { t: str => str + '_t' } }) + }) + + afterEach(() => { + propsMethodSpies.showCustomizeGasModal.resetHistory() + }) + + describe('render', () => { + it('should render a SendRowWrapper component', () => { + assert.equal(wrapper.find(SendRowWrapper).length, 1) + }) + + it('should pass the correct props to SendRowWrapper', () => { + const { + label, + } = wrapper.find(SendRowWrapper).props() + + assert.equal(label, 'gasFee_t:') + }) + + it('should render a GasFeeDisplay as a child of the SendRowWrapper', () => { + assert(wrapper.find(SendRowWrapper).childAt(0).is(GasFeeDisplay)) + }) + + it('should render the GasFeeDisplay with the correct props', () => { + const { + conversionRate, + convertedCurrency, + gasLoadingError, + gasTotal, + onClick, + } = wrapper.find(SendRowWrapper).childAt(0).props() + assert.equal(conversionRate, 20) + assert.equal(convertedCurrency, 'mockConvertedCurrency') + assert.equal(gasLoadingError, false) + assert.equal(gasTotal, 'mockGasTotal') + assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 0) + onClick() + assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 1) + }) + }) +}) |