aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/scripts/migrations/024.js2
-rw-r--r--test/unit/migrations/024-test.js12
2 files changed, 13 insertions, 1 deletions
diff --git a/app/scripts/migrations/024.js b/app/scripts/migrations/024.js
index 7a0391805..043b47ccc 100644
--- a/app/scripts/migrations/024.js
+++ b/app/scripts/migrations/024.js
@@ -29,8 +29,8 @@ module.exports = {
function transformState (state) {
const newState = state
+ if (!newState.TransactionController) return newState
const transactions = newState.TransactionController.transactions
-
newState.TransactionController.transactions = transactions.map((txMeta, _, txList) => {
if (
txMeta.status === 'unapproved' &&
diff --git a/test/unit/migrations/024-test.js b/test/unit/migrations/024-test.js
index dab77d4e4..c3c03d06b 100644
--- a/test/unit/migrations/024-test.js
+++ b/test/unit/migrations/024-test.js
@@ -1,5 +1,9 @@
const assert = require('assert')
const migration24 = require('../../../app/scripts/migrations/024')
+const firstTimeState = {
+ meta: {},
+ data: require('../../../app/scripts/first-time-state'),
+}
const properTime = (new Date()).getTime()
const storage = {
"meta": {},
@@ -34,4 +38,12 @@ describe('storage is migrated successfully and the txParams.from are lowercase',
done()
}).catch(done)
})
+
+ it('should migrate first time state', (done) => {
+ migration24.migrate(firstTimeState)
+ .then((migratedData) => {
+ assert.equal(migratedData.meta.version, 24)
+ done()
+ }).catch(done)
+ })
})