diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-09-27 07:55:11 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-09-27 07:55:11 +0800 |
commit | 80c98b16531db4c6a13a52df800967af2bc4a676 (patch) | |
tree | d2286824d2617cd2dd3d799c4f6169b3f1a27641 /test/unit | |
parent | 9fd545811226c16e11e4f2dc100a348e07f094bf (diff) | |
download | tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.tar tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.tar.gz tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.tar.bz2 tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.tar.lz tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.tar.xz tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.tar.zst tangerine-wallet-browser-80c98b16531db4c6a13a52df800967af2bc4a676.zip |
transactions: make evnt names pretty and eaiser to read
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/pending-tx-test.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/unit/pending-tx-test.js b/test/unit/pending-tx-test.js index 8c6d287f8..2865a30e6 100644 --- a/test/unit/pending-tx-test.js +++ b/test/unit/pending-tx-test.js @@ -62,7 +62,7 @@ describe('PendingTransactionTracker', function () { it('should emit \'txFailed\' if the txMeta does not have a hash', function (done) { const block = Proxy.revocable({}, {}).revoke() pendingTxTracker.getPendingTransactions = () => [txMetaNoHash] - pendingTxTracker.once('txFailed', (txId, err) => { + pendingTxTracker.once('tx:failed', (txId, err) => { assert(txId, txMetaNoHash.id, 'should pass txId') done() }) @@ -71,11 +71,11 @@ describe('PendingTransactionTracker', function () { it('should emit \'txConfirmed\' if the tx is in the block', function (done) { const block = { transactions: [txMeta]} pendingTxTracker.getPendingTransactions = () => [txMeta] - pendingTxTracker.once('txConfirmed', (txId) => { + pendingTxTracker.once('tx:confirmed', (txId) => { assert(txId, txMeta.id, 'should pass txId') done() }) - pendingTxTracker.once('txFailed', (_, err) => { done(err) }) + pendingTxTracker.once('tx:failed', (_, err) => { done(err) }) pendingTxTracker.checkForTxInBlock(block) }) }) @@ -108,7 +108,7 @@ describe('PendingTransactionTracker', function () { describe('#_checkPendingTx', function () { it('should emit \'txFailed\' if the txMeta does not have a hash', function (done) { - pendingTxTracker.once('txFailed', (txId, err) => { + pendingTxTracker.once('tx:failed', (txId, err) => { assert(txId, txMetaNoHash.id, 'should pass txId') done() }) @@ -122,11 +122,11 @@ describe('PendingTransactionTracker', function () { it('should emit \'txConfirmed\'', function (done) { providerResultStub.eth_getTransactionByHash = {blockNumber: '0x01'} - pendingTxTracker.once('txConfirmed', (txId) => { + pendingTxTracker.once('tx:confirmed', (txId) => { assert(txId, txMeta.id, 'should pass txId') done() }) - pendingTxTracker.once('txFailed', (_, err) => { done(err) }) + pendingTxTracker.once('tx:failed', (_, err) => { done(err) }) pendingTxTracker._checkPendingTx(txMeta) }) }) @@ -188,7 +188,7 @@ describe('PendingTransactionTracker', function () { ] const enoughForAllErrors = txList.concat(txList) - pendingTxTracker.on('txFailed', (_, err) => done(err)) + pendingTxTracker.on('tx:failed', (_, err) => done(err)) pendingTxTracker.getPendingTransactions = () => enoughForAllErrors pendingTxTracker._resubmitTx = async (tx) => { @@ -202,7 +202,7 @@ describe('PendingTransactionTracker', function () { pendingTxTracker.resubmitPendingTxs() }) it('should emit \'txFailed\' if it encountered a real error', function (done) { - pendingTxTracker.once('txFailed', (id, err) => err.message === 'im some real error' ? txList[id - 1].resolve() : done(err)) + pendingTxTracker.once('tx:failed', (id, err) => err.message === 'im some real error' ? txList[id - 1].resolve() : done(err)) pendingTxTracker.getPendingTransactions = () => txList pendingTxTracker._resubmitTx = async (tx) => { throw new TypeError('im some real error') } @@ -226,7 +226,7 @@ describe('PendingTransactionTracker', function () { // Stubbing out current account state: // Adding the fake tx: - pendingTxTracker.once('txFailed', (txId, err) => { + pendingTxTracker.once('tx:failed', (txId, err) => { assert(err, 'Should have a error') done() }) |