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:
434249f171
develop
feature/default_network_editable
v10.22.3
${ noResults }
46 lines
1.1 KiB
46 lines
1.1 KiB
import React from 'react';
|
|||
import sinon from 'sinon';
|
|||
import { mount } from 'enzyme';
|
|||
import RejectTransactionsModal from './reject-transactions.container';
|
|||
|
|||
describe('Reject Transactions Model', () => {
|
|||
let wrapper;
|
|||
|
|||
const props = {
|
|||
onSubmit: sinon.spy(),
|
|||
hideModal: sinon.spy(),
|
|||
unapprovedTxCount: 2,
|
|||
};
|
|||
|
|||
beforeEach(() => {
|
|||
|
wrapper = mount(<RejectTransactionsModal.WrappedComponent {...props} />, {
|
||
context: {
|
|||
t: (str) => str,
|
|||
},
|
|||
});
|
|||
});
|
|||
|
|||
afterEach(() => {
|
|||
props.hideModal.resetHistory();
|
|||
});
|
|||
|
|||
it('hides modal when cancel button is clicked', () => {
|
|||
|
const cancelButton = wrapper.find(
|
||
'.btn-default.modal-container__footer-button',
|
|||
);
|
|||
cancelButton.simulate('click');
|
|||
|
|||
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
|||
});
|
|||
|
|||
it('onSubmit is called and hides modal when reject all clicked', async () => {
|
|||
|
const rejectAllButton = wrapper.find(
|
||
'.btn-secondary.modal-container__footer-button',
|
|||
);
|
|||
rejectAllButton.simulate('click');
|
|||
|
|||
expect(await props.onSubmit.calledOnce).toStrictEqual(true);
|
|||
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
|||
});
|
|||
});
|