1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

make migration-24 compat with first-time-state

This commit is contained in:
frankiebee 2018-04-05 11:28:25 -07:00
parent 1153120fe8
commit 4efc718074
2 changed files with 13 additions and 1 deletions

View File

@ -29,8 +29,8 @@ module.exports = {
function transformState (state) { function transformState (state) {
const newState = state const newState = state
if (!newState.TransactionController) return newState
const transactions = newState.TransactionController.transactions const transactions = newState.TransactionController.transactions
newState.TransactionController.transactions = transactions.map((txMeta, _, txList) => { newState.TransactionController.transactions = transactions.map((txMeta, _, txList) => {
if ( if (
txMeta.status === 'unapproved' && txMeta.status === 'unapproved' &&

View File

@ -1,5 +1,9 @@
const assert = require('assert') const assert = require('assert')
const migration24 = require('../../../app/scripts/migrations/024') const migration24 = require('../../../app/scripts/migrations/024')
const firstTimeState = {
meta: {},
data: require('../../../app/scripts/first-time-state'),
}
const properTime = (new Date()).getTime() const properTime = (new Date()).getTime()
const storage = { const storage = {
"meta": {}, "meta": {},
@ -34,4 +38,12 @@ describe('storage is migrated successfully and the txParams.from are lowercase',
done() done()
}).catch(done) }).catch(done)
}) })
it('should migrate first time state', (done) => {
migration24.migrate(firstTimeState)
.then((migratedData) => {
assert.equal(migratedData.meta.version, 24)
done()
}).catch(done)
})
}) })