accounts-frontend/packages/app/components/profile/changePassword/ChangePassword.test.tsx

26 lines
776 B
TypeScript
Raw Normal View History

2017-08-23 00:27:35 +05:30
import React from 'react';
import expect from 'app/test/unexpected';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import ChangePassword from 'app/components/profile/changePassword/ChangePassword';
describe('<ChangePassword />', () => {
it('renders two <Input /> components', () => {
2019-12-30 14:17:29 +05:30
const component = shallow(<ChangePassword onSubmit={async () => {}} />);
expect(component.find('Input'), 'to satisfy', { length: 2 });
});
it('should call onSubmit if passwords entered', () => {
const onSubmit = sinon.spy(() => ({ catch: () => {} })).named('onSubmit');
// @ts-ignore
const component = shallow(<ChangePassword onSubmit={onSubmit} />);
component.find('Form').simulate('submit');
expect(onSubmit, 'was called');
});
});