From 474a4e941f7bb5c19ac50d61c6c681a19278b52f Mon Sep 17 00:00:00 2001
From: frankiebee <frankie.diamond@gmail.com>
Date: Mon, 21 Aug 2017 11:51:34 -0700
Subject: fix tests

---
 test/unit/tx-state-manager-test.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'test')

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)')
-- 
cgit v1.2.3