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.
43 lines
1.1 KiB
43 lines
1.1 KiB
4 years ago
|
import React from 'react';
|
||
|
import sinon from 'sinon';
|
||
|
import { mount } from 'enzyme';
|
||
4 years ago
|
import ConfirmResetAccount from './confirm-reset-account.container';
|
||
5 years ago
|
|
||
4 years ago
|
describe('Confirm Reset Account', () => {
|
||
4 years ago
|
let wrapper;
|
||
5 years ago
|
|
||
|
const props = {
|
||
|
hideModal: sinon.spy(),
|
||
|
resetAccount: sinon.stub().resolves(),
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
beforeEach(() => {
|
||
4 years ago
|
wrapper = mount(<ConfirmResetAccount.WrappedComponent {...props} />, {
|
||
|
context: {
|
||
|
t: (str) => str,
|
||
4 years ago
|
},
|
||
4 years ago
|
});
|
||
|
});
|
||
5 years ago
|
|
||
4 years ago
|
afterEach(() => {
|
||
4 years ago
|
props.hideModal.resetHistory();
|
||
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('hides modal when nevermind button is clicked', () => {
|
||
4 years ago
|
const nevermind = wrapper.find(
|
||
|
'.btn-default.modal-container__footer-button',
|
||
4 years ago
|
);
|
||
|
nevermind.simulate('click');
|
||
5 years ago
|
|
||
4 years ago
|
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('resets account and hides modal when reset button is clicked', async () => {
|
||
4 years ago
|
const reset = wrapper.find('.btn-danger.modal-container__footer-button');
|
||
|
reset.simulate('click');
|
||
5 years ago
|
|
||
4 years ago
|
expect(await props.resetAccount.calledOnce).toStrictEqual(true);
|
||
|
expect(props.hideModal.calledOnce).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
|
});
|