diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-09-27 21:46:24 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-10-01 23:23:32 +0800 |
commit | 918fb71df3079a80102fb77893af69ef3372e75f (patch) | |
tree | 6cfd03137fc27a53acee80ced7d0f78645fc0a32 /ui/app/components/send/tests | |
parent | 3741927d8d63bbee1eb9a628d2aac4c8e2e67f99 (diff) | |
download | tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.tar tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.tar.gz tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.tar.bz2 tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.tar.lz tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.tar.xz tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.tar.zst tangerine-wallet-browser-918fb71df3079a80102fb77893af69ef3372e75f.zip |
Update gas when hex data changes on send screen
Diffstat (limited to 'ui/app/components/send/tests')
-rw-r--r-- | ui/app/components/send/tests/send-component.test.js | 1 | ||||
-rw-r--r-- | ui/app/components/send/tests/send-container.test.js | 5 | ||||
-rw-r--r-- | ui/app/components/send/tests/send-utils.test.js | 12 |
3 files changed, 16 insertions, 2 deletions
diff --git a/ui/app/components/send/tests/send-component.test.js b/ui/app/components/send/tests/send-component.test.js index d2c2ee926..f4943e707 100644 --- a/ui/app/components/send/tests/send-component.test.js +++ b/ui/app/components/send/tests/send-component.test.js @@ -289,6 +289,7 @@ describe('Send Component', function () { selectedToken: 'mockSelectedToken', to: '', value: 'mockAmount', + data: undefined, } ) }) diff --git a/ui/app/components/send/tests/send-container.test.js b/ui/app/components/send/tests/send-container.test.js index 85eec6a53..6aa4bf826 100644 --- a/ui/app/components/send/tests/send-container.test.js +++ b/ui/app/components/send/tests/send-container.test.js @@ -105,6 +105,7 @@ describe('send container', () => { selectedToken: { address: '0x1' }, to: 'mockTo', value: 'mockValue', + data: undefined, } it('should dispatch a setGasTotal action when editingTransactionId is truthy', () => { @@ -117,14 +118,14 @@ describe('send container', () => { }) it('should dispatch an updateGasData action when editingTransactionId is falsy', () => { - const { selectedAddress, selectedToken, recentBlocks, blockGasLimit, to, value } = mockProps + const { selectedAddress, selectedToken, recentBlocks, blockGasLimit, to, value, data } = mockProps mapDispatchToPropsObject.updateAndSetGasTotal( Object.assign({}, mockProps, {editingTransactionId: false}) ) assert(dispatchSpy.calledOnce) assert.deepEqual( actionSpies.updateGasData.getCall(0).args[0], - { selectedAddress, selectedToken, recentBlocks, blockGasLimit, to, value } + { selectedAddress, selectedToken, recentBlocks, blockGasLimit, to, value, data } ) }) }) diff --git a/ui/app/components/send/tests/send-utils.test.js b/ui/app/components/send/tests/send-utils.test.js index 3d983a5dc..b72d87eee 100644 --- a/ui/app/components/send/tests/send-utils.test.js +++ b/ui/app/components/send/tests/send-utils.test.js @@ -367,6 +367,18 @@ describe('send utils', () => { assert.equal(result, '0xabc16') }) + it('should call ethQuery.estimateGas without a recipient if the recipient is empty and data passed', async () => { + const data = 'mockData' + const to = '' + const result = await estimateGas({...baseMockParams, data, to}) + assert.equal(baseMockParams.estimateGasMethod.callCount, 1) + assert.deepEqual( + baseMockParams.estimateGasMethod.getCall(0).args[0], + { gasPrice: undefined, value: undefined, data, from: baseExpectedCall.from, gas: baseExpectedCall.gas}, + ) + assert.equal(result, '0xabc16') + }) + it(`should return ${SIMPLE_GAS_COST} if ethQuery.getCode does not return '0x'`, async () => { assert.equal(baseMockParams.estimateGasMethod.callCount, 0) const result = await estimateGas(Object.assign({}, baseMockParams, { to: '0x123' })) |