1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
This commit is contained in:
Thomas Huang 2017-05-28 11:18:07 -07:00 committed by kumavis
parent 8af41f1b05
commit 13e6672028
9 changed files with 26 additions and 31 deletions

View File

@ -14,8 +14,8 @@ class Migrator {
async migrateData (versionedData = this.generateInitialState()) { async migrateData (versionedData = this.generateInitialState()) {
const pendingMigrations = this.migrations.filter(migrationIsPending) const pendingMigrations = this.migrations.filter(migrationIsPending)
for (let index in pendingMigrations) { for (const index in pendingMigrations) {
let migration = pendingMigrations[index] const migration = pendingMigrations[index]
versionedData = await migration.migrate(versionedData) versionedData = await migration.migrate(versionedData)
if (!versionedData.data) throw new Error('Migrator - migration returned empty data') if (!versionedData.data) throw new Error('Migrator - migration returned empty data')
if (versionedData.version !== undefined && versionedData.meta.version !== migration.version) throw new Error('Migrator - Migration did not update version number correctly') if (versionedData.version !== undefined && versionedData.meta.version !== migration.version) throw new Error('Migrator - Migration did not update version number correctly')

View File

@ -18,7 +18,7 @@ describe('BnInput', function () {
} }
const value = new BN(valueStr, 10) const value = new BN(valueStr, 10)
let inputStr = '2.3' const inputStr = '2.3'
let targetStr = '23' let targetStr = '23'
while (targetStr.length < 19) { while (targetStr.length < 19) {

View File

@ -31,7 +31,6 @@ describe('PendingTx', function () {
it('should use updated values when edited.', function (done) { it('should use updated values when edited.', function (done) {
const renderer = ReactTestUtils.createRenderer() const renderer = ReactTestUtils.createRenderer()
const newGasPrice = '0x77359400' const newGasPrice = '0x77359400'
@ -40,7 +39,6 @@ describe('PendingTx', function () {
accounts: identities, accounts: identities,
txData, txData,
sendTransaction: (txMeta, event) => { sendTransaction: (txMeta, event) => {
// Assert changes: // Assert changes:
const result = ethUtil.addHexPrefix(txMeta.txParams.gasPrice) const result = ethUtil.addHexPrefix(txMeta.txParams.gasPrice)
assert.notEqual(result, gasPrice, 'gas price should change') assert.notEqual(result, gasPrice, 'gas price should change')
@ -70,7 +68,6 @@ describe('PendingTx', function () {
ReactTestUtils.Simulate.submit(form, { preventDefault () {}, target: { checkValidity () { ReactTestUtils.Simulate.submit(form, { preventDefault () {}, target: { checkValidity () {
return true return true
} } }) } } })
} catch (e) { } catch (e) {
console.log('WHAAAA') console.log('WHAAAA')
console.error(e) console.error(e)

View File

@ -11,5 +11,4 @@ describe('explorer-link', function () {
var result = linkGen('hash', '42') var result = linkGen('hash', '42')
assert.notEqual(result.indexOf('kovan'), -1, 'kovan injected') assert.notEqual(result.indexOf('kovan'), -1, 'kovan injected')
}) })
}) })

View File

@ -37,7 +37,7 @@ describe('# Network Controller', function () {
}) })
describe('#getNetworkState', function () { describe('#getNetworkState', function () {
it('should return loading when new', function () { it('should return loading when new', function () {
let networkState = networkController.getNetworkState() const networkState = networkController.getNetworkState()
assert.equal(networkState, 'loading', 'network is loading') assert.equal(networkState, 'loading', 'network is loading')
}) })
}) })
@ -45,14 +45,14 @@ describe('# Network Controller', function () {
describe('#setNetworkState', function () { describe('#setNetworkState', function () {
it('should update the network', function () { it('should update the network', function () {
networkController.setNetworkState(1) networkController.setNetworkState(1)
let networkState = networkController.getNetworkState() const networkState = networkController.getNetworkState()
assert.equal(networkState, 1, 'network is 1') assert.equal(networkState, 1, 'network is 1')
}) })
}) })
describe('#getRpcAddressForType', function () { describe('#getRpcAddressForType', function () {
it('should return the right rpc address', function () { it('should return the right rpc address', function () {
let rpcTarget = networkController.getRpcAddressForType('mainnet') const rpcTarget = networkController.getRpcAddressForType('mainnet')
assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress') assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress')
}) })
}) })

View File

@ -320,5 +320,4 @@ describe('Transaction Controller', function () {
}) })
}) })
}) })
}) })