2017-08-22 21:57:35 +03:00
|
|
|
import React from 'react';
|
2019-12-07 21:02:00 +02:00
|
|
|
import expect from 'app/test/unexpected';
|
2016-12-10 17:58:47 +02:00
|
|
|
import sinon from 'sinon';
|
2016-05-01 20:50:55 +03:00
|
|
|
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
|
2019-12-07 21:02:00 +02:00
|
|
|
import ChangePassword from 'app/components/profile/changePassword/ChangePassword';
|
2016-05-01 20:50:55 +03:00
|
|
|
|
|
|
|
describe('<ChangePassword />', () => {
|
2019-11-27 11:03:32 +02:00
|
|
|
it('renders two <Input /> components', () => {
|
|
|
|
const component = shallow(<ChangePassword onSubmit={() => {}} />);
|
2016-05-01 20:50:55 +03:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
expect(component.find('Input'), 'to satisfy', { length: 2 });
|
|
|
|
});
|
2016-05-01 20:50:55 +03:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
it('should call onSubmit if passwords entered', () => {
|
|
|
|
const onSubmit = sinon.spy(() => ({ catch: () => {} })).named('onSubmit');
|
|
|
|
const component = shallow(<ChangePassword onSubmit={onSubmit} />);
|
2016-05-01 20:50:55 +03:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
component.find('Form').simulate('submit');
|
2016-05-01 20:50:55 +03:00
|
|
|
|
2019-11-27 11:03:32 +02:00
|
|
|
expect(onSubmit, 'was called');
|
|
|
|
});
|
2016-05-01 20:50:55 +03:00
|
|
|
});
|