diff options
author | Dan <danjm.com@gmail.com> | 2018-05-24 00:43:25 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-05-31 07:24:31 +0800 |
commit | 0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d (patch) | |
tree | d3c566fdb0485a690da5048264372514661e3830 /ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js | |
parent | 3d597cd1d2bfe74abdb945f8ec3ffe96853ed90a (diff) | |
download | tangerine-wallet-browser-0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d.tar.gz tangerine-wallet-browser-0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d.tar.zst tangerine-wallet-browser-0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d.zip |
Auto update gas estimate when to changes.
Diffstat (limited to 'ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js')
-rw-r--r-- | ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js b/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js index e58695210..58fe51dcf 100644 --- a/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js +++ b/ui/app/components/send_/send-content/send-to-row/tests/send-to-row-component.test.js @@ -2,7 +2,15 @@ import React from 'react' import assert from 'assert' import { shallow } from 'enzyme' import sinon from 'sinon' -import SendToRow from '../send-to-row.component.js' +import proxyquire from 'proxyquire' + +const SendToRow = proxyquire('../send-to-row.component.js', { + './send-to-row.utils.js': { + getToErrorObject: (to) => ({ + to: to === false ? null : `mockToErrorObject:${to}`, + }), + }, +}).default import SendRowWrapper from '../../send-row-wrapper/send-row-wrapper.component' import EnsInput from '../../../../ens-input' @@ -10,6 +18,7 @@ import EnsInput from '../../../../ens-input' const propsMethodSpies = { closeToDropdown: sinon.spy(), openToDropdown: sinon.spy(), + updateGas: sinon.spy(), updateSendTo: sinon.spy(), updateSendToError: sinon.spy(), } @@ -29,6 +38,7 @@ describe('SendToRow Component', function () { to={'mockTo'} toAccounts={['mockAccount']} toDropdownOpen={false} + updateGas={propsMethodSpies.updateGas} updateSendTo={propsMethodSpies.updateSendTo} updateSendToError={propsMethodSpies.updateSendToError} />, { context: { t: str => str + '_t' } }) @@ -61,10 +71,21 @@ describe('SendToRow Component', function () { assert.equal(propsMethodSpies.updateSendToError.callCount, 1) assert.deepEqual( propsMethodSpies.updateSendToError.getCall(0).args, - ['mockTo2'] + [{ to: 'mockToErrorObject:mockTo2' }] ) }) + it('should not call updateGas if there is a to error', () => { + assert.equal(propsMethodSpies.updateGas.callCount, 0) + instance.handleToChange('mockTo2') + assert.equal(propsMethodSpies.updateGas.callCount, 0) + }) + + it('should call updateGas if there is no to error', () => { + assert.equal(propsMethodSpies.updateGas.callCount, 0) + instance.handleToChange(false) + assert.equal(propsMethodSpies.updateGas.callCount, 1) + }) }) describe('render', () => { |