You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tag:
Branch:
Tree:
91601ebe5e
develop
feature/default_network_editable
v10.22.3
${ noResults }
65 lines
2.0 KiB
65 lines
2.0 KiB
import sinon from 'sinon';
|
|||
|
|||
import { updateSendTo } from '../../../../store/actions';
|
|||
|
|||
let mapStateToProps;
|
|||
let mapDispatchToProps;
|
|||
|
|||
jest.mock('react-redux', () => ({
|
|||
connect: (ms, md) => {
|
|||
mapStateToProps = ms;
|
|||
mapDispatchToProps = md;
|
|||
return () => ({});
|
|||
},
|
|||
}));
|
|||
|
|||
|
jest.mock('../../../../selectors', () => ({
|
||
getSendEnsResolution: (s) => `mockSendEnsResolution:${s}`,
|
|||
getSendEnsResolutionError: (s) => `mockSendEnsResolutionError:${s}`,
|
|||
getAddressBook: (s) => [{ name: `mockAddressBook:${s}` }],
|
|||
getAddressBookEntry: (s) => `mockAddressBookEntry:${s}`,
|
|||
accountsWithSendEtherInfoSelector: () => [
|
|||
{ name: `account1:mockState` },
|
|||
{ name: `account2:mockState` },
|
|||
],
|
|||
}));
|
|||
|
|||
|
jest.mock('../../../../store/actions', () => ({
|
||
updateSendTo: jest.fn(),
|
|||
}));
|
|||
|
|||
require('./add-recipient.container.js');
|
|||
|
|||
describe('add-recipient container', () => {
|
|||
describe('mapStateToProps()', () => {
|
|||
it('should map the correct properties to props', () => {
|
|||
expect(mapStateToProps('mockState')).toStrictEqual({
|
|||
addressBook: [{ name: 'mockAddressBook:mockState' }],
|
|||
contacts: [{ name: 'mockAddressBook:mockState' }],
|
|||
ensResolution: 'mockSendEnsResolution:mockState',
|
|||
ensResolutionError: 'mockSendEnsResolutionError:mockState',
|
|||
ownedAccounts: [
|
|||
{ name: `account1:mockState` },
|
|||
{ name: `account2:mockState` },
|
|||
],
|
|||
addressBookEntryName: undefined,
|
|||
nonContacts: [],
|
|||
});
|
|||
});
|
|||
});
|
|||
|
|||
describe('mapDispatchToProps()', () => {
|
|||
describe('updateSendTo()', () => {
|
|||
const dispatchSpy = sinon.spy();
|
|||
const mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy);
|
|||
|
|||
it('should dispatch an action', () => {
|
|||
mapDispatchToPropsObject.updateSendTo('mockTo', 'mockNickname');
|
|||
expect(dispatchSpy.calledOnce).toStrictEqual(true);
|
|||
expect(updateSendTo).toHaveBeenCalled();
|
|||
expect(updateSendTo).toHaveBeenCalledWith('mockTo', 'mockNickname');
|
|||
});
|
|||
});
|
|||
});
|
|||
});
|