diff options
author | Bruno Barbieri <brunobar79@gmail.com> | 2018-02-01 02:34:14 +0800 |
---|---|---|
committer | Bruno Barbieri <brunobar79@gmail.com> | 2018-02-01 02:34:14 +0800 |
commit | 94dd77d194de97b59c0a191a7439d96ff255bf41 (patch) | |
tree | 969e2c3b688b4033110bac28520901c2493e04de /test | |
parent | a70eda36515ee8dc7f0b58bf561dd14c92e70596 (diff) | |
download | tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.tar tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.tar.gz tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.tar.bz2 tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.tar.lz tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.tar.xz tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.tar.zst tangerine-wallet-browser-94dd77d194de97b59c0a191a7439d96ff255bf41.zip |
clean up
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tx-state-manager-test.js | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/test/unit/tx-state-manager-test.js b/test/unit/tx-state-manager-test.js index 3d9641453..02dc52967 100644 --- a/test/unit/tx-state-manager-test.js +++ b/test/unit/tx-state-manager-test.js @@ -241,14 +241,15 @@ describe('TransactionStateManger', function () { describe('#wipeTransactions', function () { - const specificAddress = '0xaa'; + const specificAddress = '0xaa' + const otherAddress = '0xbb' it('should remove only the transactions from a specific address', function () { const txMetas = [ - { id: 0, status: 'unapproved', txParams: { from: specificAddress, to: '0xbb' }, metamaskNetworkId: currentNetworkId }, - { id: 1, status: 'confirmed', txParams: { from: '0xbb', to: specificAddress }, metamaskNetworkId: currentNetworkId }, - { id: 2, status: 'confirmed', txParams: { from: '0xcc', to: specificAddress }, metamaskNetworkId: currentNetworkId }, + { id: 0, status: 'unapproved', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: currentNetworkId }, + { id: 1, status: 'confirmed', txParams: { from: otherAddress, to: specificAddress }, metamaskNetworkId: currentNetworkId }, + { id: 2, status: 'confirmed', txParams: { from: otherAddress, to: specificAddress }, metamaskNetworkId: currentNetworkId }, ] txMetas.forEach((txMeta) => txStateManager.addTx(txMeta, noop)) @@ -257,18 +258,15 @@ describe('TransactionStateManger', function () { const transactionsFromCurrentAddress = txStateManager.getTxList().filter((txMeta) => txMeta.txParams.from === specificAddress) const transactionsFromOtherAddresses = txStateManager.getTxList().filter((txMeta) => txMeta.txParams.from !== specificAddress) - assert.equal(transactionsFromCurrentAddress.length, 0); - assert.equal(transactionsFromOtherAddresses.length, 2); - - + assert.equal(transactionsFromCurrentAddress.length, 0) + assert.equal(transactionsFromOtherAddresses.length, 2) }) it('should not remove the transactions from other networks', function () { - const txMetas = [ - { id: 0, status: 'unapproved', txParams: { from: specificAddress, to: '0xbb' }, metamaskNetworkId: currentNetworkId }, - { id: 1, status: 'confirmed', txParams: { from: specificAddress, to: specificAddress }, metamaskNetworkId: otherNetworkId }, - { id: 2, status: 'confirmed', txParams: { from: specificAddress, to: specificAddress }, metamaskNetworkId: otherNetworkId }, + { id: 0, status: 'unapproved', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: currentNetworkId }, + { id: 1, status: 'confirmed', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: otherNetworkId }, + { id: 2, status: 'confirmed', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: otherNetworkId }, ] txMetas.forEach((txMeta) => txStateManager.addTx(txMeta, noop)) @@ -276,14 +274,10 @@ describe('TransactionStateManger', function () { txStateManager.wipeTransactions(specificAddress) const txsFromCurrentNetworkAndAddress = txStateManager.getTxList().filter((txMeta) => txMeta.txParams.from === specificAddress) - const txFromOtherNetworks= txStateManager.getFullTxList().filter((txMeta) => txMeta.metamaskNetworkId === otherNetworkId) - - console.log('NETWORK TX LIST: ', txStateManager.getTxList()); - console.log('FULL TX LIST: ', txStateManager.getFullTxList()); - - assert.equal(txsFromCurrentNetworkAndAddress.length, 0); - assert.equal(txFromOtherNetworks.length, 2); + const txFromOtherNetworks = txStateManager.getFullTxList().filter((txMeta) => txMeta.metamaskNetworkId === otherNetworkId) + assert.equal(txsFromCurrentNetworkAndAddress.length, 0) + assert.equal(txFromOtherNetworks.length, 2) }) }) |