diff options
author | kumavis <aaron@kumavis.me> | 2018-06-08 01:07:36 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-06-08 01:07:36 +0800 |
commit | 66b703b1a4ba25ddaf8278f020967b4d20351027 (patch) | |
tree | 41520dbc3ad35b3c9968cfc390ecb99db5456a33 /ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js | |
parent | 2198276bd533bec767cad954ef8b21c47c0f8c09 (diff) | |
parent | 988283778a2be52640b27a359ef3fb1130e95711 (diff) | |
download | tangerine-wallet-browser-66b703b1a4ba25ddaf8278f020967b4d20351027.tar.gz tangerine-wallet-browser-66b703b1a4ba25ddaf8278f020967b4d20351027.tar.zst tangerine-wallet-browser-66b703b1a4ba25ddaf8278f020967b4d20351027.zip |
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
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) + }) + }) +}) |