aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-08-22 02:51:34 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-08-22 02:51:34 +0800
commit474a4e941f7bb5c19ac50d61c6c681a19278b52f (patch)
tree043700a2113beac0e5427792f87638ebffbf3bda /test
parentfbba3a1ac8575b910e8a2a684748d617eec19414 (diff)
downloadtangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.tar
tangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.tar.gz
tangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.tar.bz2
tangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.tar.lz
tangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.tar.xz
tangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.tar.zst
tangerine-wallet-browser-474a4e941f7bb5c19ac50d61c6c681a19278b52f.zip
fix tests
Diffstat (limited to 'test')
-rw-r--r--test/unit/tx-state-manager-test.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/unit/tx-state-manager-test.js b/test/unit/tx-state-manager-test.js
index 998bbe152..464e50ee4 100644
--- a/test/unit/tx-state-manager-test.js
+++ b/test/unit/tx-state-manager-test.js
@@ -2,6 +2,7 @@ const assert = require('assert')
const clone = require('clone')
const ObservableStore = require('obs-store')
const TxStateManager = require('../../app/scripts/lib/tx-state-manager')
+const txStateHistoryHelper = require('../../app/scripts/lib/tx-state-history-helper')
const noop = () => true
describe('TransactionStateManger', function () {
@@ -145,7 +146,9 @@ describe('TransactionStateManger', function () {
it('replaces the tx with the same id', function () {
txStateManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
txStateManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txStateManager.updateTx({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: currentNetworkId, txParams: {} })
+ const txMeta = txStateManager.getTx('1')
+ txMeta.hash = 'foo'
+ txStateManager.updateTx(txMeta)
let result = txStateManager.getTx('1')
assert.equal(result.hash, 'foo')
})
@@ -166,16 +169,16 @@ describe('TransactionStateManger', function () {
const updatedMeta = clone(txMeta)
txStateManager.addTx(txMeta)
- const updatedTx = txController.getTx('1')
+ const updatedTx = txStateManager.getTx('1')
// verify tx was initialized correctly
assert.equal(updatedTx.history.length, 1, 'one history item (initial)')
assert.equal(Array.isArray(updatedTx.history[0]), false, 'first history item is initial state')
assert.deepEqual(updatedTx.history[0], txStateHistoryHelper.snapshotFromTxMeta(updatedTx), 'first history item is initial state')
// modify value and updateTx
updatedTx.txParams.gasPrice = desiredGasPrice
- txController.updateTx(updatedTx)
+ txStateManager.updateTx(updatedTx)
// check updated value
- const result = txController.getTx('1')
+ const result = txStateManager.getTx('1')
assert.equal(result.txParams.gasPrice, desiredGasPrice, 'gas price updated')
// validate history was updated
assert.equal(result.history.length, 2, 'two history items (initial + diff)')