<commit_before>import React from 'react';
import LoginForm from '../../../../../client/App/Exterior/Login/LoginForm';
import {shallow} from 'enzyme';

describe('LoginForm component', () => {
  it('renders without crashing', () => {
    shallow(<LoginForm />);
  });
});<commit_msg>test(login-form): added tests for the LoginForm<commit_after>import React from 'react';
import LoginForm from '../../../../../client/App/Exterior/Login/LoginForm';
import {shallow, mount} from 'enzyme';
import {object} from 'prop-types';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import {createStore, combineReducers} from 'redux';
import {reducer as formReducer} from 'redux-form';

describe('LoginForm component', () => {
  it('renders without crashing', () => {
    shallow(<LoginForm />);
  });

  it('should have an error message for email validation', () => {
    const store = createStore(combineReducers({form: formReducer, auth: {}, login: {}}));
    const muiTheme = getMuiTheme(lightBaseTheme);
    const wrapper = mount(<LoginForm muiTheme={muiTheme} store={store} />, {
      childContextTypes: {
        muiTheme: object.isRequired,
        store: object.isRequired
      },
      context: {muiTheme, store}
    });

    const emailFields = wrapper.find('TextField').findWhere(node => node.props().name === 'email');
    const input = emailFields.find('input');

    input.simulate('change', {target: {value: 'test'}});
    input.simulate('blur');

    const textField = emailFields.find('TextField');

    expect(textField).toHaveProp('errorText', 'Invalid email address');
  });
});
{'fraction_non_alphanumeric': 0.17425149700598802, 'fraction_numerical': 0.0, 'mean_word_length': 4.321656050955414, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6124305', 'n_tokens_mistral': 504, 'n_tokens_neox': 490, 'n_words': 115}