2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
import { mount } from 'enzyme';
|
2021-03-16 22:00:08 +01:00
|
|
|
import TransactionConfirmed from './transaction-confirmed.container';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('Transaction Confirmed', () => {
|
|
|
|
it('clicks ok to submit and hide modal', () => {
|
2020-02-11 17:51:13 +01:00
|
|
|
const props = {
|
|
|
|
onSubmit: sinon.spy(),
|
|
|
|
hideModal: sinon.spy(),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-02-11 17:51:13 +01:00
|
|
|
const wrapper = mount(
|
2020-11-03 00:41:28 +01:00
|
|
|
<TransactionConfirmed.WrappedComponent {...props} />,
|
|
|
|
{
|
2020-01-30 20:34:45 +01:00
|
|
|
context: {
|
2020-02-15 21:34:12 +01:00
|
|
|
t: (str) => str,
|
2020-01-30 20:34:45 +01:00
|
|
|
},
|
2020-07-14 17:20:41 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
const submit = wrapper.find(
|
|
|
|
'.btn-secondary.modal-container__footer-button',
|
|
|
|
);
|
|
|
|
submit.simulate('click');
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(props.onSubmit.calledOnce).toStrictEqual(true);
|
|
|
|
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|