aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-11-15 13:29:06 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-11-15 13:29:06 +0800
commite44b750f0f0bba3ec2b12c4f99343c62d28cd017 (patch)
treeb1d18271b90d1b728e178d4039de97ac220f0512 /test
parent18f39ef69e117a3560456a30f0e8506ed7b0e044 (diff)
parentd684bb4c17fb23deeb1ed037fe83923173795e97 (diff)
downloadtangerine-wallet-browser-e44b750f0f0bba3ec2b12c4f99343c62d28cd017.tar.gz
tangerine-wallet-browser-e44b750f0f0bba3ec2b12c4f99343c62d28cd017.tar.zst
tangerine-wallet-browser-e44b750f0f0bba3ec2b12c4f99343c62d28cd017.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into trezor-v5
Diffstat (limited to 'test')
-rwxr-xr-xtest/e2e/beta/run-drizzle.sh4
-rw-r--r--test/unit/app/controllers/transactions/pending-tx-test.js15
-rw-r--r--test/unit/app/controllers/transactions/tx-controller-test.js9
3 files changed, 20 insertions, 8 deletions
diff --git a/test/e2e/beta/run-drizzle.sh b/test/e2e/beta/run-drizzle.sh
index bfb7e6fdb..609f2765e 100755
--- a/test/e2e/beta/run-drizzle.sh
+++ b/test/e2e/beta/run-drizzle.sh
@@ -1,9 +1,5 @@
#!/usr/bin/env bash
-set -e
-set -u
-set -o pipefail
-
export PATH="$PATH:./node_modules/.bin"
npm run ganache:start -- -b 2 >> /dev/null 2>&1 &
diff --git a/test/unit/app/controllers/transactions/pending-tx-test.js b/test/unit/app/controllers/transactions/pending-tx-test.js
index ba15f1953..85b0969f5 100644
--- a/test/unit/app/controllers/transactions/pending-tx-test.js
+++ b/test/unit/app/controllers/transactions/pending-tx-test.js
@@ -24,7 +24,7 @@ describe('PendingTransactionTracker', function () {
}
txMetaNoHash = {
id: 2,
- status: 'signed',
+ status: 'submitted',
txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d'},
}
@@ -212,6 +212,7 @@ describe('PendingTransactionTracker', function () {
pendingTxTracker.publishTransaction = async (rawTx) => {
assert.equal(rawTx, txMeta.rawTx, 'Should pass the rawTx')
}
+ pendingTxTracker.approveTransaction = async () => {}
sinon.spy(pendingTxTracker, 'publishTransaction')
txMetaToTestExponentialBackoff = Object.assign({}, txMeta, {
@@ -266,6 +267,18 @@ describe('PendingTransactionTracker', function () {
assert.equal(pendingTxTracker.publishTransaction.callCount, 1, 'Should call publish transaction')
})
+
+ it('should call opts.approveTransaction with the id if the tx is not signed', async () => {
+ const stubTx = {
+ id: 40,
+ }
+ const approveMock = sinon.stub(pendingTxTracker, 'approveTransaction')
+
+ pendingTxTracker._resubmitTx(stubTx)
+
+ assert.ok(approveMock.called)
+ approveMock.restore()
+ })
})
describe('#_checkIfNonceIsTaken', function () {
diff --git a/test/unit/app/controllers/transactions/tx-controller-test.js b/test/unit/app/controllers/transactions/tx-controller-test.js
index ea58aa560..7f1d8e6f5 100644
--- a/test/unit/app/controllers/transactions/tx-controller-test.js
+++ b/test/unit/app/controllers/transactions/tx-controller-test.js
@@ -313,6 +313,7 @@ describe('Transaction Controller', function () {
assert.equal(params.gas, originalValue, 'gas unmodified')
assert.equal(params.gasPrice, originalValue, 'gas price unmodified')
assert.equal(result.hash, originalValue, `hash was set \n got: ${result.hash} \n expected: ${originalValue}`)
+ assert.equal(result.status, 'submitted', 'Should have reached the submitted status.')
signStub.restore()
pubStub.restore()
done()
@@ -469,9 +470,11 @@ describe('Transaction Controller', function () {
{ id: 7, status: 'failed', metamaskNetworkId: currentNetworkId, txParams: {} },
])
})
- it('should show only submitted transactions as pending transasction', function () {
- assert(txController.pendingTxTracker.getPendingTransactions().length, 1)
- assert(txController.pendingTxTracker.getPendingTransactions()[0].status, 'submitted')
+ it('should show only submitted and approved transactions as pending transasction', function () {
+ assert(txController.pendingTxTracker.getPendingTransactions().length, 2)
+ const states = txController.pendingTxTracker.getPendingTransactions().map(tx => tx.status)
+ assert(states.includes('approved'), 'includes approved')
+ assert(states.includes('submitted'), 'includes submitted')
})
})
})