mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
90 lines
2.0 KiB
JavaScript
90 lines
2.0 KiB
JavaScript
import { migrate, version } from './087';
|
|
|
|
describe('migration #87', () => {
|
|
it('should update the version metadata', async () => {
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 86,
|
|
},
|
|
data: {},
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.meta).toStrictEqual({
|
|
version,
|
|
});
|
|
});
|
|
|
|
it('should return state unaltered if there is no tokens controller state', async () => {
|
|
const oldData = {
|
|
other: 'data',
|
|
};
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 86,
|
|
},
|
|
data: oldData,
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.data).toStrictEqual(oldData);
|
|
});
|
|
|
|
it('should return state unaltered if there is no tokens controller suggested assets state', async () => {
|
|
const oldData = {
|
|
other: 'data',
|
|
TokensController: {
|
|
allDetectedTokens: {},
|
|
allIgnoredTokens: {},
|
|
allTokens: {},
|
|
detectedTokens: [],
|
|
ignoredTokens: [],
|
|
tokens: [],
|
|
},
|
|
};
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 86,
|
|
},
|
|
data: oldData,
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.data).toStrictEqual(oldData);
|
|
});
|
|
|
|
it('should remove the suggested assets state', async () => {
|
|
const oldData = {
|
|
other: 'data',
|
|
TokensController: {
|
|
allDetectedTokens: {},
|
|
allIgnoredTokens: {},
|
|
allTokens: {},
|
|
detectedTokens: [],
|
|
ignoredTokens: [],
|
|
suggestedAssets: [],
|
|
tokens: [],
|
|
},
|
|
};
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 86,
|
|
},
|
|
data: oldData,
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.data).toStrictEqual({
|
|
other: 'data',
|
|
TokensController: {
|
|
allDetectedTokens: {},
|
|
allIgnoredTokens: {},
|
|
allTokens: {},
|
|
detectedTokens: [],
|
|
ignoredTokens: [],
|
|
tokens: [],
|
|
},
|
|
});
|
|
});
|
|
});
|