accounts-frontend/tests/components/profile/changePassword/ChangePassword.test.jsx

25 lines
716 B
React
Raw Normal View History

2016-07-30 16:14:43 +05:30
import expect from 'unexpected';
import React from 'react';
import { shallow } from 'enzyme';
import ChangePassword from 'components/profile/changePassword/ChangePassword';
describe('<ChangePassword />', () => {
it('renders two <Input /> components', () => {
const component = shallow(<ChangePassword onSubmit={() => {}} />);
2016-07-30 16:14:43 +05:30
expect(component.find('Input'), 'to satisfy', {length: 2});
});
it('should call onSubmit if passwords entered', () => {
2016-07-30 16:14:43 +05:30
const onSubmit = sinon.spy().named('onSubmit');
const component = shallow(<ChangePassword onSubmit={onSubmit} />);
component.find('Form').simulate('submit');
2016-07-30 16:14:43 +05:30
expect(onSubmit, 'was called');
});
});