Skip to content

Commit

Permalink
chore: Add unit tests to getSwapsDefaultToken
Browse files Browse the repository at this point in the history
  • Loading branch information
gambinish committed Nov 25, 2024
1 parent 77c0ad0 commit 5da7495
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ui/selectors/selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2029,4 +2029,41 @@ describe('#getConnectedSitesList', () => {
expect(selectors.getSelectedEvmInternalAccount(state)).toBe(undefined);
});
});

describe('getSwapsDefaultToken', () => {
it('returns the token object for the current chainId when no overrideChainId is provided', () => {
const expectedToken = {
symbol: 'ETH',
name: 'Ether',
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
balance: '966987986469506564059',
string: '966.988',
iconUrl: './images/black-eth-logo.svg',
};

const result = selectors.getSwapsDefaultToken(mockState);

expect(result).toStrictEqual(expectedToken);
});

it('returns the token object for the overridden chainId when overrideChainId is provided', () => {
const expectedToken = {
symbol: 'POL',
name: 'Polygon',
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
balance: '966987986469506564059',
string: '966.988',
iconUrl: './images/pol-token.svg',
};

const result = selectors.getSwapsDefaultToken(
mockState,
CHAIN_IDS.POLYGON,
);

expect(result).toStrictEqual(expectedToken);
});
});
});

0 comments on commit 5da7495

Please sign in to comment.