aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-04-06 03:32:55 +0800
committerGitHub <noreply@github.com>2018-04-06 03:32:55 +0800
commit50c36074fb94d0a3de53d32a5aee35f573162397 (patch)
treeefec0fd2bab9e2519e3d5d4e3b887e57f8c0fa22
parente774fbcece4154e796d710228e90cf2c413fb810 (diff)
parent4efc718074a819c15beceece5e0f08b49c8b60bb (diff)
downloadtangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.tar
tangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.tar.gz
tangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.tar.bz2
tangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.tar.lz
tangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.tar.xz
tangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.tar.zst
tangerine-wallet-browser-50c36074fb94d0a3de53d32a5aee35f573162397.zip
Merge pull request #3899 from MetaMask/migration-24-fix
make migration-24 compat with first-time-state
-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)
+ })
})