1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

pending tx tracker - test - expect warning event on resubmit failure

This commit is contained in:
kumavis 2017-10-02 15:20:18 -07:00
parent ed77304e73
commit 25a80932a6

View File

@ -199,8 +199,15 @@ describe('PendingTransactionTracker', function () {
pendingTxTracker.resubmitPendingTxs()
})
it('should emit \'tx:failed\' if it encountered a real error', function (done) {
pendingTxTracker.once('tx:failed', (id, err) => err.message === 'im some real error' ? txList[id - 1].resolve() : done(err))
it('should emit \'tx:warning\' if it encountered a real error', function (done) {
pendingTxTracker.once('tx:warning', (txMeta, err) => {
if (err.message === 'im some real error') {
const matchingTx = txList.find(tx => tx.id === txMeta.id)
matchingTx.resolve()
} else {
done(err)
}
})
pendingTxTracker.getPendingTransactions = () => txList
pendingTxTracker._resubmitTx = async (tx) => { throw new TypeError('im some real error') }