diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-06-27 02:55:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-27 02:55:26 +0800 |
commit | 60feeb393be5d84679dd7b94dba58540ffa166bd (patch) | |
tree | 08f2ecc52efb4f3a9ab99a1d567ccfdd407cc550 /ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js | |
parent | 27c348ba77c9be7baafd48516ef6f46f5402f4d0 (diff) | |
parent | e05eeb56da51e89e94267bcfe0b4b80ace55d09e (diff) | |
download | tangerine-wallet-browser-60feeb393be5d84679dd7b94dba58540ffa166bd.tar.gz tangerine-wallet-browser-60feeb393be5d84679dd7b94dba58540ffa166bd.tar.zst tangerine-wallet-browser-60feeb393be5d84679dd7b94dba58540ffa166bd.zip |
Merge pull request #4627 from TrejGun/gas-fee-display
refactor gas-fee-display component
Diffstat (limited to 'ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js')
-rw-r--r-- | ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js new file mode 100644 index 000000000..9f2f1a0cf --- /dev/null +++ b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js @@ -0,0 +1,55 @@ +import React from 'react' +import assert from 'assert' +import {shallow} from 'enzyme' +import GasFeeDisplay from '../gas-fee-display.component' +import CurrencyDisplay from '../../../../../send/currency-display' +import sinon from 'sinon' + + +const propsMethodSpies = { + showCustomizeGasModal: sinon.spy(), +} + +describe.only('SendGasRow Component', function() { + let wrapper + + beforeEach(() => { + wrapper = shallow(<GasFeeDisplay + conversionRate={20} + gasTotal={'mockGasTotal'} + onClick={propsMethodSpies.showCustomizeGasModal} + primaryCurrency={'mockPrimaryCurrency'} + convertedCurrency={'mockConvertedCurrency'} + />, {context: {t: str => str + '_t'}}) + }) + + afterEach(() => { + propsMethodSpies.showCustomizeGasModal.resetHistory() + }) + + describe('render', () => { + it('should render a CurrencyDisplay component', () => { + assert.equal(wrapper.find(CurrencyDisplay).length, 1) + }) + + it('should render the CurrencyDisplay with the correct props', () => { + const { + conversionRate, + convertedCurrency, + value, + } = wrapper.find(CurrencyDisplay).props() + assert.equal(conversionRate, 20) + assert.equal(convertedCurrency, 'mockConvertedCurrency') + assert.equal(value, 'mockGasTotal') + }) + + it('should render the Button with the correct props', () => { + const { + onClick, + } = wrapper.find('button').props() + assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 0) + onClick() + assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 1) + }) + }) +}) |