mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 03:20:23 +01:00
40 lines
997 B
JavaScript
40 lines
997 B
JavaScript
import sinon from 'sinon';
|
|
|
|
import { updateSendAmount } from '../../../../ducks/send';
|
|
|
|
let mapDispatchToProps;
|
|
|
|
jest.mock('react-redux', () => ({
|
|
connect: (_, md) => {
|
|
mapDispatchToProps = md;
|
|
return () => ({});
|
|
},
|
|
}));
|
|
|
|
jest.mock('../../../../ducks/send', () => ({
|
|
updateSendAmount: jest.fn(),
|
|
}));
|
|
|
|
require('./send-amount-row.container');
|
|
|
|
describe('send-amount-row container', () => {
|
|
describe('mapDispatchToProps()', () => {
|
|
let dispatchSpy;
|
|
let mapDispatchToPropsObject;
|
|
|
|
beforeEach(() => {
|
|
dispatchSpy = sinon.spy();
|
|
mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy);
|
|
});
|
|
|
|
describe('updateSendAmount()', () => {
|
|
it('should dispatch an action', () => {
|
|
mapDispatchToPropsObject.updateSendAmount('mockAmount');
|
|
expect(dispatchSpy.calledOnce).toStrictEqual(true);
|
|
expect(updateSendAmount).toHaveBeenCalled();
|
|
expect(updateSendAmount).toHaveBeenCalledWith('mockAmount');
|
|
});
|
|
});
|
|
});
|
|
});
|