Files
Rabby/__tests__/migration/customizedTokenMigration.test.ts
heisenberg 2abebf8177 feat: new assets ui (#1471)
* feat: init new ui

* fix: conflict

* feat: loading

* feat: new ui

* feat: manage address

* feat: + portfolio load

* fix: ui

* chore: revert lock

* feat: stash code

* feat: token data

* chore: update rabby-api

* feat: init asset list

* chore: reset lock file

* fix: init token

* feat: init tabs

* fix

* fix: rabby-api

* feat: token list

* feat: token list

* feat: add detail page

* fix: nft

* feat: search and sort token (#1474)

* feat: search and sort token

* feat: + customize and blocked

* feat: hooks

* feat: update customize and block

* chore: clean code

* feat: update rabby-api

* feat: tab

* feat: init nft view

* feat: +protocols

* feat: search for portfolios

* feat: + chain filter

* feat: + add asset from dapp

* feat: nft ui

* fix: edge case

* chore: clean code (#1478)

* feat: add nft view

* chore: clean up

* feat: migration

* fix: bugs

* fix: bugs

* fix: ui bugs

* chore: clean up

* fix: chain icon

* fix: assets list performance (#1479)

* fix: assets list performance

* fix: data load

* fix: ui bugs

* feat: sort token by chain balance (#1480)

* feat: sort token by chain balance

* chore: update rabby-api

* fix: ui

* fix: not patch no balance token into token list

* fix: ui bugs

* fix: ui bugs

* feat: not enable virtual list when protocol count less than 50 (#1482)

* fix: balance

* feat: filter no balance tokens

* fix: token detail

* feat: adjust sort/pick logic about chain-selector and token selector (#1481)

* feat: update style of SendToken page.

* feat: adjust sort logic for chain item in chain selector.

* chore: code cleanup.

* feat: adjust order in chain selector.

* feat: separate disabled tokens on tokenSelecor for swap.

* fix: issues

---------

Co-authored-by: vvvvvv1vvvvvv <galennnnnnn@gmail.com>

* fix: ui bugs

* fix: style

---------

Co-authored-by: vvvvvv1vvvvvv <galennnnnnn@gmail.com>
Co-authored-by: vvvvvv1vvvvvv <86296331+vvvvvv1vvvvvv@users.noreply.github.com>
Co-authored-by: richardo2016x <104543757+richardo2016x@users.noreply.github.com>
2023-06-27 13:58:35 +08:00

50 lines
1.2 KiB
TypeScript

/**
* @jest-environment jsdom
*/
import customizedTokenMigration from '../../src/migrations/customizedTokenMigration';
const data = {
preference: {
addedToken: {
'0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb85': [
'bsc:0x9a78649501bbaac285ea4187299471b7ad4abd35',
'cro:0x9a78649501bbaac285ea4187299471b7ad4abd36',
],
'0xf08c90c7f470b640a21dd9b3744eca3d1d16a044': [
'eth:0x9a78649501bbbac285ea4187299471b7ad4abd35',
'bsc:0x9a78649501bbaac285ea4187299471b7ad4abd35',
],
},
},
};
test('should migrate data', () => {
return customizedTokenMigration.migrator(data).then((result) => {
expect(result!.preference.customizedToken).toEqual([
{
chain: 'bsc',
address: '0x9a78649501bbaac285ea4187299471b7ad4abd35',
},
{
chain: 'cro',
address: '0x9a78649501bbaac285ea4187299471b7ad4abd36',
},
{
chain: 'eth',
address: '0x9a78649501bbbac285ea4187299471b7ad4abd35',
},
]);
});
});
const data1 = {
preference: {
addedToken: {},
},
};
test('do nothing if empty', () => {
return customizedTokenMigration.migrator(data1).then((result) => {
expect(result!.preference.customizedToken).toEqual([]);
});
});