mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
adding transaction controller tests
This commit is contained in:
parent
afb5788861
commit
6affd8f949
@ -30,7 +30,7 @@ async function checkAccount (networkId, account) {
|
|||||||
const damnedAccounts = await keyring.getAccounts()
|
const damnedAccounts = await keyring.getAccounts()
|
||||||
for (let i = 0; i < damnedAccounts.length; i++) {
|
for (let i = 0; i < damnedAccounts.length; i++) {
|
||||||
if (damnedAccounts[i].toLowerCase() === accountToCheck) {
|
if (damnedAccounts[i].toLowerCase() === accountToCheck) {
|
||||||
throw new Error('this is a public account')
|
throw new Error('Recipient is a public account')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -185,6 +185,23 @@ describe('Transaction Controller', function () {
|
|||||||
.catch(done)
|
.catch(done)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should fail if recipient is public', function (done) {
|
||||||
|
txController.networkStore = new ObservableStore(1)
|
||||||
|
txController.addUnapprovedTransaction({ from: '0x1678a085c290ebd122dc42cba69373b5953b831d', to: '0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2' })
|
||||||
|
.catch((err) => {
|
||||||
|
if (err.message === 'Recipient is a public account') done()
|
||||||
|
else done(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not fail if recipient is public but not on mainnet', function (done) {
|
||||||
|
txController.once('newUnapprovedTx', (txMetaFromEmit) => {
|
||||||
|
assert(txMetaFromEmit, 'txMeta is falsey')
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
txController.addUnapprovedTransaction({ from: '0x1678a085c290ebd122dc42cba69373b5953b831d', to: '0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2' })
|
||||||
|
.catch(done)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#addTxGasDefaults', function () {
|
describe('#addTxGasDefaults', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user