2017-08-22 21:57:35 +03:00
|
|
|
import React from 'react';
|
2019-06-30 16:32:50 +03:00
|
|
|
import expect from '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';
|
|
|
|
|
|
|
|
import ChangePassword from 'components/profile/changePassword/ChangePassword';
|
|
|
|
|
|
|
|
describe('<ChangePassword />', () => {
|
2016-05-02 08:51:47 +03:00
|
|
|
it('renders two <Input /> components', () => {
|
2016-05-01 20:50:55 +03:00
|
|
|
const component = shallow(<ChangePassword onSubmit={() => {}} />);
|
|
|
|
|
2016-07-30 13:44:43 +03:00
|
|
|
expect(component.find('Input'), 'to satisfy', {length: 2});
|
2016-05-01 20:50:55 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should call onSubmit if passwords entered', () => {
|
2017-03-02 07:58:33 +02:00
|
|
|
const onSubmit = sinon.spy(() => ({catch: () => {}})).named('onSubmit');
|
2016-05-01 20:50:55 +03:00
|
|
|
const component = shallow(<ChangePassword onSubmit={onSubmit} />);
|
|
|
|
|
|
|
|
component.find('Form').simulate('submit');
|
|
|
|
|
2016-07-30 13:44:43 +03:00
|
|
|
expect(onSubmit, 'was called');
|
2016-05-01 20:50:55 +03:00
|
|
|
});
|
|
|
|
});
|