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
|
|
|
}));
|
|
|
|
|
|
|
|
require('./transaction-activity-log.container.js');
|
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',
|
2021-03-09 22:37:19 +01:00
|
|
|
frequentRpcListDetail: [],
|
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',
|
|
|
|
frequentRpcListDetail: [
|
|
|
|
{
|
|
|
|
rpcUrl: 'https://customnetwork.com/',
|
|
|
|
rpcPrefs: {
|
|
|
|
blockExplorerUrl: 'https://customblockexplorer.com/',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
provider: {
|
|
|
|
rpcUrl: 'https://customnetwork.com/',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|