2021-04-15 20:01:46 +02:00
|
|
|
/* eslint-disable import/unambiguous */
|
2021-02-04 19:15:23 +01:00
|
|
|
let mapStateToProps;
|
2018-08-31 21:34:22 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
jest.mock('react-redux', () => ({
|
|
|
|
connect: (ms) => {
|
|
|
|
mapStateToProps = ms;
|
|
|
|
return () => ({});
|
2018-08-31 21:34:22 +02:00
|
|
|
},
|
2021-04-15 20:01:46 +02:00
|
|
|
}));
|
|
|
|
|
2022-07-27 21:32:17 +02:00
|
|
|
require('./transaction-activity-log.container');
|
2018-08-31 21:34:22 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('TransactionActivityLog container', () => {
|
|
|
|
describe('mapStateToProps()', () => {
|
|
|
|
it('should return the correct props', () => {
|
2018-08-31 21:34:22 +02:00
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 280.45,
|
2018-10-26 10:26:43 +02:00
|
|
|
nativeCurrency: 'ETH',
|
2023-03-09 22:00:28 +01:00
|
|
|
networkConfigurations: {},
|
2023-05-02 17:53:20 +02:00
|
|
|
providerConfig: {
|
2023-01-27 18:17:47 +01:00
|
|
|
ticker: 'ETH',
|
|
|
|
},
|
2018-08-31 21:34:22 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-08-31 21:34:22 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(mapStateToProps(mockState)).toStrictEqual({
|
2020-11-03 00:41:28 +01:00
|
|
|
conversionRate: 280.45,
|
|
|
|
nativeCurrency: 'ETH',
|
2021-03-09 22:37:19 +01:00
|
|
|
rpcPrefs: {},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('should return the correct props when on a custom network', () => {
|
2021-03-09 22:37:19 +01:00
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
conversionRate: 280.45,
|
|
|
|
nativeCurrency: 'ETH',
|
2023-03-09 22:00:28 +01:00
|
|
|
networkConfigurations: {
|
|
|
|
networkConfigurationId: {
|
2021-03-09 22:37:19 +01:00
|
|
|
rpcUrl: 'https://customnetwork.com/',
|
|
|
|
},
|
2023-03-09 22:00:28 +01:00
|
|
|
},
|
2023-05-02 17:53:20 +02:00
|
|
|
providerConfig: {
|
2021-03-09 22:37:19 +01:00
|
|
|
rpcUrl: 'https://customnetwork.com/',
|
2023-01-27 18:17:47 +01:00
|
|
|
ticker: 'ETH',
|
2023-03-09 22:00:28 +01:00
|
|
|
rpcPrefs: {
|
|
|
|
blockExplorerUrl: 'https://customblockexplorer.com/',
|
|
|
|
},
|
2021-03-09 22:37:19 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(mapStateToProps(mockState)).toStrictEqual({
|
2021-03-09 22:37:19 +01:00
|
|
|
conversionRate: 280.45,
|
|
|
|
nativeCurrency: 'ETH',
|
|
|
|
rpcPrefs: {
|
|
|
|
blockExplorerUrl: 'https://customblockexplorer.com/',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|