aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2018-12-14 03:14:46 +0800
committerGitHub <noreply@github.com>2018-12-14 03:14:46 +0800
commitb5d6452454de8d12340e5902914fba9f420865dc (patch)
tree34b68e4e54e2140e52e542cd9ae6a790fb45ca5d /test/unit
parentc5861c88a5e8ca98e52a7acc13479dbba0341eb1 (diff)
downloadtangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.tar
tangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.tar.gz
tangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.tar.bz2
tangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.tar.lz
tangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.tar.xz
tangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.tar.zst
tangerine-wallet-browser-b5d6452454de8d12340e5902914fba9f420865dc.zip
Disallow loading as metamaskNetworkId (#5924)
* transactions - throw an error if a transaction is generated while the network is loading * add tests for failing when netId is loading
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/app/controllers/transactions/tx-controller-test.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/unit/app/controllers/transactions/tx-controller-test.js b/test/unit/app/controllers/transactions/tx-controller-test.js
index 74161e26c..9000cd364 100644
--- a/test/unit/app/controllers/transactions/tx-controller-test.js
+++ b/test/unit/app/controllers/transactions/tx-controller-test.js
@@ -12,7 +12,7 @@ const { createTestProviderTools, getTestAccounts } = require('../../../../stub/p
const noop = () => true
const currentNetworkId = 42
-
+const netStore = new ObservableStore(currentNetworkId)
describe('Transaction Controller', function () {
let txController, provider, providerResultStub, fromAccount
@@ -32,7 +32,7 @@ describe('Transaction Controller', function () {
txController = new TransactionController({
provider,
getGasPrice: function () { return '0xee6b2800' },
- networkStore: new ObservableStore(currentNetworkId),
+ networkStore: netStore,
txHistoryLimit: 10,
blockTracker: blockTrackerStub,
signTransaction: (ethTx) => new Promise((resolve) => {
@@ -227,6 +227,15 @@ describe('Transaction Controller', function () {
txController.addUnapprovedTransaction({ from: selectedAddress, to: '0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2' })
.catch(done)
})
+
+ it('should fail if netId is loading', function (done) {
+ txController.networkStore = new ObservableStore('loading')
+ txController.addUnapprovedTransaction({ from: selectedAddress, to: '0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2' })
+ .catch((err) => {
+ if (err.message === 'MetaMask is having trouble connecting to the network') done()
+ else done(err)
+ })
+ })
})
describe('#addTxGasDefaults', function () {