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