Skip to content

Commit 5da7495

Browse files
committed
chore: Add unit tests to getSwapsDefaultToken
1 parent 77c0ad0 commit 5da7495

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

ui/selectors/selectors.test.js

+37
Original file line numberDiff line numberDiff line change
@@ -2029,4 +2029,41 @@ describe('#getConnectedSitesList', () => {
20292029
expect(selectors.getSelectedEvmInternalAccount(state)).toBe(undefined);
20302030
});
20312031
});
2032+
2033+
describe('getSwapsDefaultToken', () => {
2034+
it('returns the token object for the current chainId when no overrideChainId is provided', () => {
2035+
const expectedToken = {
2036+
symbol: 'ETH',
2037+
name: 'Ether',
2038+
address: '0x0000000000000000000000000000000000000000',
2039+
decimals: 18,
2040+
balance: '966987986469506564059',
2041+
string: '966.988',
2042+
iconUrl: './images/black-eth-logo.svg',
2043+
};
2044+
2045+
const result = selectors.getSwapsDefaultToken(mockState);
2046+
2047+
expect(result).toStrictEqual(expectedToken);
2048+
});
2049+
2050+
it('returns the token object for the overridden chainId when overrideChainId is provided', () => {
2051+
const expectedToken = {
2052+
symbol: 'POL',
2053+
name: 'Polygon',
2054+
address: '0x0000000000000000000000000000000000000000',
2055+
decimals: 18,
2056+
balance: '966987986469506564059',
2057+
string: '966.988',
2058+
iconUrl: './images/pol-token.svg',
2059+
};
2060+
2061+
const result = selectors.getSwapsDefaultToken(
2062+
mockState,
2063+
CHAIN_IDS.POLYGON,
2064+
);
2065+
2066+
expect(result).toStrictEqual(expectedToken);
2067+
});
2068+
});
20322069
});

0 commit comments

Comments
 (0)