Skip to content

Commit

Permalink
Add additional unit test for edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
gambinish committed Aug 29, 2024
1 parent 2adad06 commit a1092f9
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions app/scripts/migrations/121.1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,43 @@ describe(`migration #${version}`, () => {
expect(transformedState.data).toStrictEqual(expectedState);
});

it('Does not update ticker to POL if ticker is not MATIC, but still updates imageURL in networkConfigurations', async () => {
const oldState = {
NetworkController: {
networkConfigurations: {
'0x89': {
chainId: '0x89',
ticker: 'NOT_MATIC',
rpcPrefs: {
imageUrl: './images/matic-token.svg',
},
},
},
},
};

const expectedState = {
NetworkController: {
networkConfigurations: {
'0x89': {
chainId: '0x89',
ticker: 'NOT_MATIC',
rpcPrefs: {
imageUrl: './images/pol-token.svg',
},
},
},
},
};

const transformedState = await migrate({
meta: { version: oldVersion },
data: oldState,
});

expect(transformedState.data).toStrictEqual(expectedState);
});

it('Does not update tickers for other network configurations, updates only ticker and imageURL for chain 0x89', async () => {
const oldState = {
NetworkController: {
Expand Down

0 comments on commit a1092f9

Please sign in to comment.