From 9b92ba4c47d5489c5c0f822045360be708110cac Mon Sep 17 00:00:00 2001 From: frankiebee Date: Mon, 25 Jun 2018 15:07:54 -0700 Subject: trandsactions - remove rejected transactions from history --- .../app/controllers/transactions/tx-state-manager-test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/unit/app/controllers/transactions/tx-state-manager-test.js') diff --git a/test/unit/app/controllers/transactions/tx-state-manager-test.js b/test/unit/app/controllers/transactions/tx-state-manager-test.js index 20bc08b94..f2d0175cb 100644 --- a/test/unit/app/controllers/transactions/tx-state-manager-test.js +++ b/test/unit/app/controllers/transactions/tx-state-manager-test.js @@ -288,4 +288,18 @@ describe('TransactionStateManager', function () { }) }) + + describe.only('#_removeTx', function () { + it('should remove the transaction from the storage', () => { + txStateManager._saveTxList([ {id: 1} ]) + txStateManager._removeTx(1) + assert(!txStateManager.getFullTxList().length, 'txList should be empty') + }) + + it('should only remove the transaction with ID 1 from the storage', () => { + txStateManager._saveTxList([ {id: 1}, {id: 2} ]) + txStateManager._removeTx(1) + assert.equal(txStateManager.getFullTxList()[0].id, 2, 'txList should have a id of 2') + }) + }) }) -- cgit From 7b1f57e05d7a186be085ffcc8807516499218cba Mon Sep 17 00:00:00 2001 From: frankiebee Date: Mon, 25 Jun 2018 15:16:27 -0700 Subject: woops - remove .only Co-authored-by: @jennypollack --- test/unit/app/controllers/transactions/tx-state-manager-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/app/controllers/transactions/tx-state-manager-test.js') diff --git a/test/unit/app/controllers/transactions/tx-state-manager-test.js b/test/unit/app/controllers/transactions/tx-state-manager-test.js index f2d0175cb..8b7dc78aa 100644 --- a/test/unit/app/controllers/transactions/tx-state-manager-test.js +++ b/test/unit/app/controllers/transactions/tx-state-manager-test.js @@ -289,7 +289,7 @@ describe('TransactionStateManager', function () { }) }) - describe.only('#_removeTx', function () { + describe('#_removeTx', function () { it('should remove the transaction from the storage', () => { txStateManager._saveTxList([ {id: 1} ]) txStateManager._removeTx(1) -- cgit From 94a4f99115cf549a3014d29d828e7a432bf36a62 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Mon, 25 Jun 2018 16:16:51 -0700 Subject: tests - fix cancle transaction test to better fit new behavior --- .../unit/app/controllers/transactions/tx-state-manager-test.js | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'test/unit/app/controllers/transactions/tx-state-manager-test.js') diff --git a/test/unit/app/controllers/transactions/tx-state-manager-test.js b/test/unit/app/controllers/transactions/tx-state-manager-test.js index 8b7dc78aa..39c2d6337 100644 --- a/test/unit/app/controllers/transactions/tx-state-manager-test.js +++ b/test/unit/app/controllers/transactions/tx-state-manager-test.js @@ -45,16 +45,6 @@ describe('TransactionStateManager', function () { }) describe('#setTxStatusRejected', function () { - it('sets the tx status to rejected', function () { - let tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} } - txStateManager.addTx(tx) - txStateManager.setTxStatusRejected(1) - let result = txStateManager.getTxList() - assert.ok(Array.isArray(result)) - assert.equal(result.length, 1) - assert.equal(result[0].status, 'rejected') - }) - it('should emit a rejected event to signal the exciton of callback', (done) => { let tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} } txStateManager.addTx(tx) -- cgit From b30499886f5f738aeb93df2571cf07e2b9897ae1 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Tue, 10 Jul 2018 15:35:27 -0700 Subject: test - check that #setTxStatusRejected removes transaction from history --- test/unit/app/controllers/transactions/tx-state-manager-test.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/unit/app/controllers/transactions/tx-state-manager-test.js') diff --git a/test/unit/app/controllers/transactions/tx-state-manager-test.js b/test/unit/app/controllers/transactions/tx-state-manager-test.js index 089b7a8a6..88bdaa60e 100644 --- a/test/unit/app/controllers/transactions/tx-state-manager-test.js +++ b/test/unit/app/controllers/transactions/tx-state-manager-test.js @@ -43,6 +43,15 @@ describe('TransactionStateManager', function () { }) describe('#setTxStatusRejected', function () { + it('sets the tx status to rejected and removes it from history', function () { + const tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} } + txStateManager.addTx(tx) + txStateManager.setTxStatusRejected(1) + const result = txStateManager.getTxList() + assert.ok(Array.isArray(result)) + assert.equal(result.length, 0) + }) + it('should emit a rejected event to signal the exciton of callback', (done) => { const tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} } txStateManager.addTx(tx) -- cgit