mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-12 04:37:13 +01:00
40 lines
1000 B
JavaScript
40 lines
1000 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.js');
|
|
|
|
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');
|
|
});
|
|
});
|
|
});
|
|
});
|