mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Tidy up Migrator tests (#9264)
This commit is contained in:
parent
09e7f24b2d
commit
6f4c3b3405
@ -3,29 +3,30 @@ import assert from 'assert'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import Migrator from '../../../app/scripts/lib/migrator'
|
||||
import liveMigrations from '../../../app/scripts/migrations'
|
||||
import data from '../../../app/scripts/first-time-state'
|
||||
|
||||
const stubMigrations = [
|
||||
{
|
||||
version: 1,
|
||||
migrate: (data) => {
|
||||
migrate: (state) => {
|
||||
// clone the data just like we do in migrations
|
||||
const clonedData = cloneDeep(data)
|
||||
const clonedData = cloneDeep(state)
|
||||
clonedData.meta.version = 1
|
||||
return Promise.resolve(clonedData)
|
||||
},
|
||||
},
|
||||
{
|
||||
version: 2,
|
||||
migrate: (data) => {
|
||||
const clonedData = cloneDeep(data)
|
||||
migrate: (state) => {
|
||||
const clonedData = cloneDeep(state)
|
||||
clonedData.meta.version = 2
|
||||
return Promise.resolve(clonedData)
|
||||
},
|
||||
},
|
||||
{
|
||||
version: 3,
|
||||
migrate: (data) => {
|
||||
const clonedData = cloneDeep(data)
|
||||
migrate: (state) => {
|
||||
const clonedData = cloneDeep(state)
|
||||
clonedData.meta.version = 3
|
||||
return Promise.resolve(clonedData)
|
||||
},
|
||||
@ -33,8 +34,6 @@ const stubMigrations = [
|
||||
]
|
||||
const versionedData = { meta: { version: 0 }, data: { hello: 'world' } }
|
||||
|
||||
import data from '../../../app/scripts/first-time-state'
|
||||
|
||||
const firstTimeState = {
|
||||
meta: { version: 0 },
|
||||
data,
|
||||
|
Loading…
Reference in New Issue
Block a user