diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-05-11 08:26:51 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-05-11 08:26:51 +0800 |
commit | e9b11a430b8f447e9c6f21c1b639d150976f98cf (patch) | |
tree | 13943277d0d4d7ddf509332e0a0fb79491d1a6be /test | |
parent | d737bd1633977174ddf3d3248ee6873cc3adca8e (diff) | |
download | tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.tar tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.tar.gz tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.tar.bz2 tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.tar.lz tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.tar.xz tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.tar.zst tangerine-wallet-browser-e9b11a430b8f447e9c6f21c1b639d150976f98cf.zip |
Add an attempt at a unit test for reproducing #1407
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/components/pending-tx-test.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js new file mode 100644 index 000000000..e0f02a5bb --- /dev/null +++ b/test/unit/components/pending-tx-test.js @@ -0,0 +1,61 @@ +var assert = require('assert') +var PendingTx = require('../../../ui/app/components/pending-tx') + +describe('PendingTx', function () { + let pendingTxComponent + + const identities = { + '0xfdea65c8e26263f6d9a1b5de9555d2931a33b826': { + name: 'Main Account 1', + balance: '0x00000000000000056bc75e2d63100000', + }, + } + + const gasPrice = '0x4A817C800' // 20 Gwei + const txData = { + 'id':5021615666270214, + 'time':1494458763011, + 'status':'unapproved', + 'metamaskNetworkId':'1494442339676', + 'txParams':{ + 'from':'0xfdea65c8e26263f6d9a1b5de9555d2931a33b826', + 'to':'0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb', + 'value':'0xde0b6b3a7640000', + gasPrice, + 'gas':'0x7b0c'}, + 'gasLimitSpecified':false, + 'estimatedGas':'0x5208', + } + + + it('should use updated values when edited.', function (done) { + + const props = { + identities, + accounts: identities, + txData, + sendTransaction: (txMeta, event) => { + assert.notEqual(txMeta.txParams.gasPrice, gasPrice, 'gas price should change') + done() + }, + } + + pendingTxComponent = new PendingTx(props) + + const noop = () => {} + + pendingTxComponent.componentDidMount = () => { + + const newGasPrice = '0x451456' + pendingTxComponent.gasPriceChanged(newGasPrice) + + setTimeout(() => { + pendingTxComponent.onSubmit({ preventDefault: noop }) + }, 20) + } + + pendingTxComponent.props = props + pendingTxComponent.render() + }) + +}) |