-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { migrate, version } from './138'; | ||
|
||
const oldVersion = 137; | ||
|
||
describe(`migration #${version}`, () => { | ||
it('updates the version metadata', async () => { | ||
const oldStorage = { | ||
meta: { version: oldVersion }, | ||
data: {}, | ||
}; | ||
const newStorage = await migrate(oldStorage); | ||
expect(newStorage.meta).toStrictEqual({ version }); | ||
}); | ||
|
||
describe(`migration #${version}`, () => { | ||
it('removes the redesignedTransactionsEnabled preference if it is set to true', async () => { | ||
const oldStorage = { | ||
meta: { version: oldVersion }, | ||
data: { | ||
PreferencesController: { | ||
preferences: { | ||
redesignedTransactionsEnabled: true, | ||
}, | ||
}, | ||
}, | ||
}; | ||
const expectedData = { | ||
PreferencesController: { | ||
preferences: {}, | ||
}, | ||
}; | ||
const newStorage = await migrate(oldStorage); | ||
|
||
expect(newStorage.data).toStrictEqual(expectedData); | ||
}); | ||
|
||
it('removes the redesignedTransactionsEnabled preference if it is set to false', async () => { | ||
const oldStorage = { | ||
meta: { version: oldVersion }, | ||
data: { | ||
PreferencesController: { | ||
preferences: { | ||
redesignedTransactionsEnabled: false, | ||
}, | ||
}, | ||
}, | ||
}; | ||
const expectedData = { | ||
PreferencesController: { | ||
preferences: {}, | ||
}, | ||
}; | ||
const newStorage = await migrate(oldStorage); | ||
|
||
expect(newStorage.data).toStrictEqual(expectedData); | ||
}); | ||
|
||
it('does nothing to other PreferencesController state if there is not a redesignedTransactionsEnabled preference', async () => { | ||
const oldStorage = { | ||
meta: { version: oldVersion }, | ||
data: { | ||
PreferencesController: { | ||
existingPreference: true, | ||
}, | ||
}, | ||
}; | ||
|
||
const expectedData = { | ||
PreferencesController: { | ||
existingPreference: true, | ||
}, | ||
}; | ||
|
||
const newStorage = await migrate(oldStorage); | ||
|
||
expect(newStorage.data).toStrictEqual(expectedData); | ||
}); | ||
}); | ||
}); |