1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/migrations/068.test.js
Alex Donesky 81ea24f08a
Feat/collectibles display (#12873)
* Wiring up Collectibles lists/items

* wip

* more wip

* more more wip

* yet more wip

* wippp

* more wipppp

* closer

* wroking

* more wip

* cleanup

* cleanup

* add-collectible form validation

* update default ipfs-gateway

* update refresh button

* fix proptypes issue + add more padding to asset background

* css tweaking

* more cleanup

* more cleanup

* more cleanup

* add migration

* address feedback

* fix migration + cleanup

* bumping controllers version + adapting new collectiblesController shape

* fix yarn dedupe
2021-12-01 10:10:17 -06:00

57 lines
1.6 KiB
JavaScript

import { IPFS_DEFAULT_GATEWAY_URL } from '../../../shared/constants/network';
import migration68 from './068';
describe('migration #68', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 67,
},
data: {},
};
const newStorage = await migration68.migrate(oldStorage);
expect(newStorage.meta).toStrictEqual({
version: 68,
});
});
it('should set preference ipfsGateway to "https://cloudflare-ipfs.com" if ipfsGateway is old default dweb.link', async () => {
const expectedValue = IPFS_DEFAULT_GATEWAY_URL; // = https://cloudflare-ipfs.com
const oldStorage = {
meta: {},
data: {
PreferencesController: {
preferences: {
ipfsGateway: 'dweb.link',
},
},
},
};
const newStorage = await migration68.migrate(oldStorage);
expect(newStorage.data.PreferencesController.preferences.ipfsGateway).toBe(
expectedValue,
);
});
it('should update preference ipfsGateway to a full url version of user set ipfsGateway if ipfsGateway is not old default dweb.link', async () => {
const expectedValue = 'https://random.ipfs/';
const oldStorage = {
meta: {},
data: {
PreferencesController: {
preferences: {
ipfsGateway: 'random.ipfs',
},
},
},
};
const newStorage = await migration68.migrate(oldStorage);
expect(newStorage.data.PreferencesController.preferences.ipfsGateway).toBe(
expectedValue,
);
});
});