2021-02-04 19:15:23 +01:00
|
|
|
import sinon from 'sinon';
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2021-06-23 23:35:25 +02:00
|
|
|
import { updateSendAmount } from '../../../../ducks/send';
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
let mapDispatchToProps;
|
|
|
|
|
|
|
|
jest.mock('react-redux', () => ({
|
|
|
|
connect: (_, md) => {
|
|
|
|
mapDispatchToProps = md;
|
|
|
|
return () => ({});
|
2018-06-29 19:19:40 +02:00
|
|
|
},
|
2021-04-15 20:01:46 +02:00
|
|
|
}));
|
|
|
|
|
2021-06-23 23:35:25 +02:00
|
|
|
jest.mock('../../../../ducks/send', () => ({
|
2021-06-10 19:53:15 +02:00
|
|
|
updateSendAmount: jest.fn(),
|
2021-04-15 20:01:46 +02:00
|
|
|
}));
|
|
|
|
|
|
|
|
require('./send-amount-row.container.js');
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('send-amount-row container', () => {
|
|
|
|
describe('mapDispatchToProps()', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
let dispatchSpy;
|
|
|
|
let mapDispatchToPropsObject;
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
beforeEach(() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatchSpy = sinon.spy();
|
|
|
|
mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy);
|
|
|
|
});
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('updateSendAmount()', () => {
|
|
|
|
it('should dispatch an action', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
mapDispatchToPropsObject.updateSendAmount('mockAmount');
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(dispatchSpy.calledOnce).toStrictEqual(true);
|
|
|
|
expect(updateSendAmount).toHaveBeenCalled();
|
|
|
|
expect(updateSendAmount).toHaveBeenCalledWith('mockAmount');
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|