mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix warning for unit tests
This commit is contained in:
parent
390f86113a
commit
0da41263ac
@ -1,5 +1,4 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const path = require('path')
|
|
||||||
const ethUtil = require('ethereumjs-util')
|
const ethUtil = require('ethereumjs-util')
|
||||||
const accountImporter = require('../../../app/scripts/account-import-strategies/index')
|
const accountImporter = require('../../../app/scripts/account-import-strategies/index')
|
||||||
const { assertRejects } = require('../test-utils')
|
const { assertRejects } = require('../test-utils')
|
||||||
|
@ -5,9 +5,6 @@ const {
|
|||||||
getNetworkDisplayName,
|
getNetworkDisplayName,
|
||||||
} = require('../../../../app/scripts/controllers/network/util')
|
} = require('../../../../app/scripts/controllers/network/util')
|
||||||
|
|
||||||
const { createTestProviderTools } = require('../../../stub/provider')
|
|
||||||
const providerResultStub = {}
|
|
||||||
|
|
||||||
describe('# Network Controller', function () {
|
describe('# Network Controller', function () {
|
||||||
let networkController
|
let networkController
|
||||||
const noop = () => {}
|
const noop = () => {}
|
||||||
|
@ -4,9 +4,7 @@ const MockTxGen = require('../../../../lib/mock-tx-gen')
|
|||||||
const providerResultStub = {}
|
const providerResultStub = {}
|
||||||
|
|
||||||
describe('Nonce Tracker', function () {
|
describe('Nonce Tracker', function () {
|
||||||
let nonceTracker, provider
|
let nonceTracker, pendingTxs, confirmedTxs
|
||||||
let getPendingTransactions, pendingTxs
|
|
||||||
let getConfirmedTransactions, confirmedTxs
|
|
||||||
|
|
||||||
describe('#getNonceLock', function () {
|
describe('#getNonceLock', function () {
|
||||||
|
|
||||||
@ -182,8 +180,8 @@ describe('Nonce Tracker', function () {
|
|||||||
describe('When all three return different values', function () {
|
describe('When all three return different values', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
const confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 10 })
|
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 10 })
|
||||||
const pendingTxs = txGen.generate({
|
pendingTxs = txGen.generate({
|
||||||
status: 'submitted',
|
status: 'submitted',
|
||||||
nonce: 100,
|
nonce: 100,
|
||||||
}, { count: 1 })
|
}, { count: 1 })
|
||||||
@ -202,8 +200,8 @@ describe('Nonce Tracker', function () {
|
|||||||
describe('Faq issue 67', function () {
|
describe('Faq issue 67', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
const confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 64 })
|
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 64 })
|
||||||
const pendingTxs = txGen.generate({
|
pendingTxs = txGen.generate({
|
||||||
status: 'submitted',
|
status: 'submitted',
|
||||||
}, { count: 10 })
|
}, { count: 10 })
|
||||||
// 0x40 is 64 in hex:
|
// 0x40 is 64 in hex:
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const ethUtil = require('ethereumjs-util')
|
|
||||||
const EthTx = require('ethereumjs-tx')
|
|
||||||
const ObservableStore = require('obs-store')
|
|
||||||
const clone = require('clone')
|
|
||||||
const { createTestProviderTools } = require('../../../../stub/provider')
|
const { createTestProviderTools } = require('../../../../stub/provider')
|
||||||
const PendingTransactionTracker = require('../../../../../app/scripts/controllers/transactions/pending-tx-tracker')
|
const PendingTransactionTracker = require('../../../../../app/scripts/controllers/transactions/pending-tx-tracker')
|
||||||
const MockTxGen = require('../../../../lib/mock-tx-gen')
|
const MockTxGen = require('../../../../lib/mock-tx-gen')
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
const noop = () => true
|
|
||||||
const currentNetworkId = 42
|
|
||||||
const otherNetworkId = 36
|
|
||||||
const privKey = new Buffer('8718b9618a37d1fc78c436511fc6df3c8258d3250635bba617f33003270ec03e', 'hex')
|
|
||||||
|
|
||||||
|
|
||||||
describe('PendingTransactionTracker', function () {
|
describe('PendingTransactionTracker', function () {
|
||||||
let pendingTxTracker, txMeta, txMetaNoHash, txMetaNoRawTx, providerResultStub,
|
let pendingTxTracker, txMeta, txMetaNoHash, providerResultStub,
|
||||||
provider, txMeta3, txList, knownErrors
|
provider, txMeta3, txList, knownErrors
|
||||||
this.timeout(10000)
|
this.timeout(10000)
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@ -34,11 +26,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
status: 'signed',
|
status: 'signed',
|
||||||
txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d'},
|
txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d'},
|
||||||
}
|
}
|
||||||
txMetaNoRawTx = {
|
|
||||||
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: 'signed',
|
|
||||||
txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d'},
|
|
||||||
}
|
|
||||||
providerResultStub = {}
|
providerResultStub = {}
|
||||||
provider = createTestProviderTools({ scaffold: providerResultStub }).provider
|
provider = createTestProviderTools({ scaffold: providerResultStub }).provider
|
||||||
|
|
||||||
@ -133,22 +121,20 @@ describe('PendingTransactionTracker', function () {
|
|||||||
})
|
})
|
||||||
describe('#queryPendingTxs', function () {
|
describe('#queryPendingTxs', function () {
|
||||||
it('should call #_checkPendingTxs if their is no oldBlock', function (done) {
|
it('should call #_checkPendingTxs if their is no oldBlock', function (done) {
|
||||||
let newBlock, oldBlock
|
let oldBlock
|
||||||
newBlock = { number: '0x01' }
|
const newBlock = { number: '0x01' }
|
||||||
pendingTxTracker._checkPendingTxs = done
|
pendingTxTracker._checkPendingTxs = done
|
||||||
pendingTxTracker.queryPendingTxs({ oldBlock, newBlock })
|
pendingTxTracker.queryPendingTxs({ oldBlock, newBlock })
|
||||||
})
|
})
|
||||||
it('should call #_checkPendingTxs if oldBlock and the newBlock have a diff of greater then 1', function (done) {
|
it('should call #_checkPendingTxs if oldBlock and the newBlock have a diff of greater then 1', function (done) {
|
||||||
let newBlock, oldBlock
|
const oldBlock = { number: '0x01' }
|
||||||
oldBlock = { number: '0x01' }
|
const newBlock = { number: '0x03' }
|
||||||
newBlock = { number: '0x03' }
|
|
||||||
pendingTxTracker._checkPendingTxs = done
|
pendingTxTracker._checkPendingTxs = done
|
||||||
pendingTxTracker.queryPendingTxs({ oldBlock, newBlock })
|
pendingTxTracker.queryPendingTxs({ oldBlock, newBlock })
|
||||||
})
|
})
|
||||||
it('should not call #_checkPendingTxs if oldBlock and the newBlock have a diff of 1 or less', function (done) {
|
it('should not call #_checkPendingTxs if oldBlock and the newBlock have a diff of 1 or less', function (done) {
|
||||||
let newBlock, oldBlock
|
const oldBlock = { number: '0x1' }
|
||||||
oldBlock = { number: '0x1' }
|
const newBlock = { number: '0x2' }
|
||||||
newBlock = { number: '0x2' }
|
|
||||||
pendingTxTracker._checkPendingTxs = () => {
|
pendingTxTracker._checkPendingTxs = () => {
|
||||||
const err = new Error('should not call #_checkPendingTxs if oldBlock and the newBlock have a diff of 1 or less')
|
const err = new Error('should not call #_checkPendingTxs if oldBlock and the newBlock have a diff of 1 or less')
|
||||||
done(err)
|
done(err)
|
||||||
@ -197,7 +183,6 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it('should warp all txMeta\'s in #_checkPendingTx', function (done) {
|
it('should warp all txMeta\'s in #_checkPendingTx', function (done) {
|
||||||
pendingTxTracker.getPendingTransactions = () => txList
|
pendingTxTracker.getPendingTransactions = () => txList
|
||||||
pendingTxTracker._checkPendingTx = (tx) => { tx.resolve(tx) }
|
pendingTxTracker._checkPendingTx = (tx) => { tx.resolve(tx) }
|
||||||
const list = txList.map
|
|
||||||
Promise.all(txList.map((tx) => tx.processed))
|
Promise.all(txList.map((tx) => tx.processed))
|
||||||
.then((txCompletedList) => done())
|
.then((txCompletedList) => done())
|
||||||
.catch(done)
|
.catch(done)
|
||||||
@ -275,7 +260,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
})
|
})
|
||||||
describe('#_resubmitTx', function () {
|
describe('#_resubmitTx', function () {
|
||||||
const mockFirstRetryBlockNumber = '0x1'
|
const mockFirstRetryBlockNumber = '0x1'
|
||||||
let txMetaToTestExponentialBackoff
|
let txMetaToTestExponentialBackoff, enoughBalance
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
pendingTxTracker.getBalance = (address) => {
|
pendingTxTracker.getBalance = (address) => {
|
||||||
@ -298,7 +283,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should publish the transaction', function (done) {
|
it('should publish the transaction', function (done) {
|
||||||
const enoughBalance = '0x100000'
|
enoughBalance = '0x100000'
|
||||||
|
|
||||||
// Stubbing out current account state:
|
// Stubbing out current account state:
|
||||||
// Adding the fake tx:
|
// Adding the fake tx:
|
||||||
@ -313,7 +298,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should not publish the transaction if the limit of retries has been exceeded', function (done) {
|
it('should not publish the transaction if the limit of retries has been exceeded', function (done) {
|
||||||
const enoughBalance = '0x100000'
|
enoughBalance = '0x100000'
|
||||||
const mockLatestBlockNumber = '0x5'
|
const mockLatestBlockNumber = '0x5'
|
||||||
|
|
||||||
pendingTxTracker._resubmitTx(txMetaToTestExponentialBackoff, mockLatestBlockNumber)
|
pendingTxTracker._resubmitTx(txMetaToTestExponentialBackoff, mockLatestBlockNumber)
|
||||||
@ -327,7 +312,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should publish the transaction if the number of blocks since last retry exceeds the last set limit', function (done) {
|
it('should publish the transaction if the number of blocks since last retry exceeds the last set limit', function (done) {
|
||||||
const enoughBalance = '0x100000'
|
enoughBalance = '0x100000'
|
||||||
const mockLatestBlockNumber = '0x11'
|
const mockLatestBlockNumber = '0x11'
|
||||||
|
|
||||||
pendingTxTracker._resubmitTx(txMetaToTestExponentialBackoff, mockLatestBlockNumber)
|
pendingTxTracker._resubmitTx(txMetaToTestExponentialBackoff, mockLatestBlockNumber)
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const ethUtil = require('ethereumjs-util')
|
const ethUtil = require('ethereumjs-util')
|
||||||
const EthTx = require('ethereumjs-tx')
|
const EthTx = require('ethereumjs-tx')
|
||||||
const EthjsQuery = require('ethjs-query')
|
|
||||||
const ObservableStore = require('obs-store')
|
const ObservableStore = require('obs-store')
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
const TransactionController = require('../../../../../app/scripts/controllers/transactions')
|
const TransactionController = require('../../../../../app/scripts/controllers/transactions')
|
||||||
const TxGasUtils = require('../../../../../app/scripts/controllers/transactions/tx-gas-utils')
|
|
||||||
const { createTestProviderTools, getTestAccounts } = require('../../../../stub/provider')
|
const { createTestProviderTools, getTestAccounts } = require('../../../../stub/provider')
|
||||||
|
|
||||||
const noop = () => true
|
const noop = () => true
|
||||||
const currentNetworkId = 42
|
const currentNetworkId = 42
|
||||||
const otherNetworkId = 36
|
|
||||||
|
|
||||||
|
|
||||||
describe('Transaction Controller', function () {
|
describe('Transaction Controller', function () {
|
||||||
let txController, provider, providerResultStub, query, fromAccount
|
let txController, provider, providerResultStub, fromAccount
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
providerResultStub = {
|
providerResultStub = {
|
||||||
@ -24,7 +21,6 @@ describe('Transaction Controller', function () {
|
|||||||
eth_getCode: '0x',
|
eth_getCode: '0x',
|
||||||
}
|
}
|
||||||
provider = createTestProviderTools({ scaffold: providerResultStub }).provider
|
provider = createTestProviderTools({ scaffold: providerResultStub }).provider
|
||||||
query = new EthjsQuery(provider)
|
|
||||||
fromAccount = getTestAccounts()[0]
|
fromAccount = getTestAccounts()[0]
|
||||||
|
|
||||||
txController = new TransactionController({
|
txController = new TransactionController({
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const Transaction = require('ethereumjs-tx')
|
const Transaction = require('ethereumjs-tx')
|
||||||
const BN = require('bn.js')
|
|
||||||
|
|
||||||
|
|
||||||
const { hexToBn, bnToHex } = require('../../../../../app/scripts/lib/util')
|
const { hexToBn, bnToHex } = require('../../../../../app/scripts/lib/util')
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const clone = require('clone')
|
|
||||||
const ObservableStore = require('obs-store')
|
|
||||||
const TxStateManager = require('../../../../../app/scripts/controllers/transactions/tx-state-manager')
|
const TxStateManager = require('../../../../../app/scripts/controllers/transactions/tx-state-manager')
|
||||||
const txStateHistoryHelper = require('../../../../../app/scripts/controllers/transactions/lib/tx-state-history-helper')
|
const txStateHistoryHelper = require('../../../../../app/scripts/controllers/transactions/lib/tx-state-history-helper')
|
||||||
const noop = () => true
|
const noop = () => true
|
||||||
@ -59,6 +57,7 @@ describe('TransactionStateManager', function () {
|
|||||||
const tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
|
const tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
|
||||||
txStateManager.addTx(tx)
|
txStateManager.addTx(tx)
|
||||||
const noop = function (err, txId) {
|
const noop = function (err, txId) {
|
||||||
|
assert(err, null)
|
||||||
assert(true, 'event listener has been triggered and noop executed')
|
assert(true, 'event listener has been triggered and noop executed')
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
@ -166,8 +165,6 @@ describe('TransactionStateManager', function () {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatedMeta = clone(txMeta)
|
|
||||||
|
|
||||||
txStateManager.addTx(txMeta)
|
txStateManager.addTx(txMeta)
|
||||||
const updatedTx = txStateManager.getTx('1')
|
const updatedTx = txStateManager.getTx('1')
|
||||||
// verify tx was initialized correctly
|
// verify tx was initialized correctly
|
||||||
|
@ -35,8 +35,8 @@ describe('EdgeEncryptor', function () {
|
|||||||
.then(function (encryptedData) {
|
.then(function (encryptedData) {
|
||||||
const encryptedObject = JSON.parse(encryptedData)
|
const encryptedObject = JSON.parse(encryptedData)
|
||||||
assert.ok(encryptedObject.data, 'there is no data')
|
assert.ok(encryptedObject.data, 'there is no data')
|
||||||
assert.ok(encryptedObject.iv && encryptedObject.iv.length != 0, 'there is no iv')
|
assert.ok(encryptedObject.iv && encryptedObject.iv.length !== 0, 'there is no iv')
|
||||||
assert.ok(encryptedObject.salt && encryptedObject.salt.length != 0, 'there is no salt')
|
assert.ok(encryptedObject.salt && encryptedObject.salt.length !== 0, 'there is no salt')
|
||||||
done()
|
done()
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
done(err)
|
done(err)
|
||||||
|
@ -13,6 +13,7 @@ describe('nodeify', function () {
|
|||||||
it('should retain original context', function (done) {
|
it('should retain original context', function (done) {
|
||||||
var nodified = nodeify(obj.promiseFunc, obj)
|
var nodified = nodeify(obj.promiseFunc, obj)
|
||||||
nodified('baz', function (err, res) {
|
nodified('baz', function (err, res) {
|
||||||
|
assert(err, null)
|
||||||
assert.equal(res, 'barbaz')
|
assert.equal(res, 'barbaz')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,6 @@ const assert = require('assert')
|
|||||||
const PendingBalanceCalculator = require('../../../app/scripts/lib/pending-balance-calculator')
|
const PendingBalanceCalculator = require('../../../app/scripts/lib/pending-balance-calculator')
|
||||||
const MockTxGen = require('../../lib/mock-tx-gen')
|
const MockTxGen = require('../../lib/mock-tx-gen')
|
||||||
const BN = require('ethereumjs-util').BN
|
const BN = require('ethereumjs-util').BN
|
||||||
const providerResultStub = {}
|
|
||||||
|
|
||||||
const zeroBn = new BN(0)
|
const zeroBn = new BN(0)
|
||||||
const etherBn = new BN(String(1e18))
|
const etherBn = new BN(String(1e18))
|
||||||
|
@ -13,7 +13,6 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const hdKeyTree = 'HD Key Tree'
|
const hdKeyTree = 'HD Key Tree'
|
||||||
|
|
||||||
let keyringController
|
let keyringController
|
||||||
let vault
|
|
||||||
let primaryKeyring
|
let primaryKeyring
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
@ -24,7 +23,7 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
|
|
||||||
assert(keyringController)
|
assert(keyringController)
|
||||||
|
|
||||||
vault = await keyringController.createNewVaultAndKeychain(password)
|
await keyringController.createNewVaultAndKeychain(password)
|
||||||
primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
|
primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const seedWords = serialized.mnemonic
|
const seedWords = serialized.mnemonic
|
||||||
assert.notEqual(seedWords.length, 0)
|
assert.notEqual(seedWords.length, 0)
|
||||||
|
|
||||||
const result = await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
|
await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should be able to verify created account (upper case) with seed words', async function () {
|
it('should be able to verify created account (upper case) with seed words', async function () {
|
||||||
@ -51,7 +50,7 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const seedWords = serialized.mnemonic
|
const seedWords = serialized.mnemonic
|
||||||
assert.notEqual(seedWords.length, 0)
|
assert.notEqual(seedWords.length, 0)
|
||||||
|
|
||||||
const result = await seedPhraseVerifier.verifyAccounts(upperCaseAccounts, seedWords)
|
await seedPhraseVerifier.verifyAccounts(upperCaseAccounts, seedWords)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should be able to verify created account (lower case) with seed words', async function () {
|
it('should be able to verify created account (lower case) with seed words', async function () {
|
||||||
@ -64,7 +63,7 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const seedWords = serialized.mnemonic
|
const seedWords = serialized.mnemonic
|
||||||
assert.notEqual(seedWords.length, 0)
|
assert.notEqual(seedWords.length, 0)
|
||||||
|
|
||||||
const result = await seedPhraseVerifier.verifyAccounts(lowerCaseAccounts, seedWords)
|
await seedPhraseVerifier.verifyAccounts(lowerCaseAccounts, seedWords)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return error with good but different seed words', async function () {
|
it('should return error with good but different seed words', async function () {
|
||||||
@ -72,11 +71,11 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const createdAccounts = await primaryKeyring.getAccounts()
|
const createdAccounts = await primaryKeyring.getAccounts()
|
||||||
assert.equal(createdAccounts.length, 1)
|
assert.equal(createdAccounts.length, 1)
|
||||||
|
|
||||||
const serialized = await primaryKeyring.serialize()
|
await primaryKeyring.serialize()
|
||||||
const seedWords = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
const seedWords = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
|
await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
|
||||||
assert.fail('Should reject')
|
assert.fail('Should reject')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
assert.ok(err.message.indexOf('Not identical accounts!') >= 0, 'Wrong error message')
|
assert.ok(err.message.indexOf('Not identical accounts!') >= 0, 'Wrong error message')
|
||||||
@ -88,11 +87,11 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const createdAccounts = await primaryKeyring.getAccounts()
|
const createdAccounts = await primaryKeyring.getAccounts()
|
||||||
assert.equal(createdAccounts.length, 1)
|
assert.equal(createdAccounts.length, 1)
|
||||||
|
|
||||||
const serialized = await primaryKeyring.serialize()
|
await primaryKeyring.serialize()
|
||||||
const seedWords = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
const seedWords = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await seedPhraseVerifier.verifyAccounts(undefined, seedWords)
|
await seedPhraseVerifier.verifyAccounts(undefined, seedWords)
|
||||||
assert.fail('Should reject')
|
assert.fail('Should reject')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
assert.equal(err.message, 'No created accounts defined.')
|
assert.equal(err.message, 'No created accounts defined.')
|
||||||
@ -104,11 +103,11 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const createdAccounts = await primaryKeyring.getAccounts()
|
const createdAccounts = await primaryKeyring.getAccounts()
|
||||||
assert.equal(createdAccounts.length, 1)
|
assert.equal(createdAccounts.length, 1)
|
||||||
|
|
||||||
const serialized = await primaryKeyring.serialize()
|
await primaryKeyring.serialize()
|
||||||
const seedWords = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
const seedWords = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await seedPhraseVerifier.verifyAccounts([], seedWords)
|
await seedPhraseVerifier.verifyAccounts([], seedWords)
|
||||||
assert.fail('Should reject')
|
assert.fail('Should reject')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
assert.equal(err.message, 'No created accounts defined.')
|
assert.equal(err.message, 'No created accounts defined.')
|
||||||
@ -117,8 +116,8 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
|
|
||||||
it('should be able to verify more than one created account with seed words', async function () {
|
it('should be able to verify more than one created account with seed words', async function () {
|
||||||
|
|
||||||
const keyState = await keyringController.addNewAccount(primaryKeyring)
|
await keyringController.addNewAccount(primaryKeyring)
|
||||||
const keyState2 = await keyringController.addNewAccount(primaryKeyring)
|
await keyringController.addNewAccount(primaryKeyring)
|
||||||
|
|
||||||
const createdAccounts = await primaryKeyring.getAccounts()
|
const createdAccounts = await primaryKeyring.getAccounts()
|
||||||
assert.equal(createdAccounts.length, 3)
|
assert.equal(createdAccounts.length, 3)
|
||||||
@ -127,7 +126,7 @@ describe('SeedPhraseVerifier', function () {
|
|||||||
const seedWords = serialized.mnemonic
|
const seedWords = serialized.mnemonic
|
||||||
assert.notEqual(seedWords.length, 0)
|
assert.notEqual(seedWords.length, 0)
|
||||||
|
|
||||||
const result = await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
|
await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const migration23 = require('../../../app/scripts/migrations/023')
|
const migration23 = require('../../../app/scripts/migrations/023')
|
||||||
const properTime = (new Date()).getTime()
|
|
||||||
const storage = {
|
const storage = {
|
||||||
'meta': {},
|
'meta': {},
|
||||||
'data': {
|
'data': {
|
||||||
|
@ -4,7 +4,6 @@ const firstTimeState = {
|
|||||||
meta: {},
|
meta: {},
|
||||||
data: require('../../../app/scripts/first-time-state'),
|
data: require('../../../app/scripts/first-time-state'),
|
||||||
}
|
}
|
||||||
const properTime = (new Date()).getTime()
|
|
||||||
const storage = {
|
const storage = {
|
||||||
'meta': {},
|
'meta': {},
|
||||||
'data': {
|
'data': {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const migrationTemplate = require('../../../app/scripts/migrations/template')
|
const migrationTemplate = require('../../../app/scripts/migrations/template')
|
||||||
const properTime = (new Date()).getTime()
|
|
||||||
const storage = {
|
const storage = {
|
||||||
meta: {},
|
meta: {},
|
||||||
data: {},
|
data: {},
|
||||||
|
Loading…
Reference in New Issue
Block a user