2017-08-23 00:27:35 +05:30
|
|
|
import React from 'react';
|
2019-12-08 00:32:00 +05:30
|
|
|
import expect from 'app/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';
|
|
|
|
|
2019-12-08 00:32:00 +05:30
|
|
|
import ChangePassword from 'app/components/profile/changePassword/ChangePassword';
|
2016-05-01 23:20:55 +05:30
|
|
|
|
|
|
|
describe('<ChangePassword />', () => {
|
2019-11-27 14:33:32 +05:30
|
|
|
it('renders two <Input /> components', () => {
|
2019-12-30 14:17:29 +05:30
|
|
|
const component = shallow(<ChangePassword onSubmit={async () => {}} />);
|
2016-05-01 23:20:55 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
expect(component.find('Input'), 'to satisfy', { length: 2 });
|
|
|
|
});
|
2016-05-01 23:20:55 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should call onSubmit if passwords entered', () => {
|
|
|
|
const onSubmit = sinon.spy(() => ({ catch: () => {} })).named('onSubmit');
|
2020-01-18 02:07:52 +05:30
|
|
|
// @ts-ignore
|
2019-11-27 14:33:32 +05:30
|
|
|
const component = shallow(<ChangePassword onSubmit={onSubmit} />);
|
2016-05-01 23:20:55 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
component.find('Form').simulate('submit');
|
2016-05-01 23:20:55 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
expect(onSubmit, 'was called');
|
|
|
|
});
|
2016-05-01 23:20:55 +05:30
|
|
|
});
|