<commit_before>import React from 'react';
import { shallow } from 'enzyme';
import configureStore from 'redux-mock-store';
import ucastniciTestData from '../../entities/ucastnici/ucastniciTestData';
import UbytovaniContainer from './UbytovaniContainer';

const mockStore = configureStore();

let store;
let wrapper;
beforeEach(() => {
  const state = {
    ...ucastniciTestData,
    registrator: {
      ubytovani: {
        jenUbytovani: true,
        textFilter: ''
      }
    }
  };
  store = mockStore(state);
  store.dispatch = jest.fn();
  wrapper = shallow(<UbytovaniContainer store={store} />);
});

it('maps state and dispatch to props', () => {
  expect(wrapper.props().jenUbytovani).toBe(true);
  expect(wrapper.props().textFilter).toEqual('');
  expect(wrapper.props().ubytovani).toBeTruthy();
  expect(wrapper.props().ubytovani).toMatchSnapshot();
});

it('maps onUbytovaniChange to dispatch changeUbytovani action', () => {
  wrapper.props().onUbytovaniChange();

  expect(store.dispatch).toHaveBeenCalledWith({ type: 'UBYTOVANI_CHANGE_UBYTOVANI' });
});

it('maps onTextFilterChange to dispatch textFilterChange action', () => {
  wrapper.props().onTextFilterChange('Kl');

  expect(store.dispatch).toHaveBeenCalledWith({
    type: 'UBYTOVANI_TEXT_FILTER_CHANGE',
    textFilter: 'Kl'
  });
});<commit_msg>Add a test case for onSelect().<commit_after>import React from 'react';
import { shallow } from 'enzyme';
import configureStore from 'redux-mock-store';
import ucastniciTestData from '../../entities/ucastnici/ucastniciTestData';
import UbytovaniContainer from './UbytovaniContainer';

const mockStore = configureStore();

let store;
let wrapper;
beforeEach(() => {
  const state = {
    ...ucastniciTestData,
    registrator: {
      ubytovani: {
        jenUbytovani: true,
        textFilter: ''
      }
    }
  };
  store = mockStore(state);
  store.dispatch = jest.fn();
  wrapper = shallow(<UbytovaniContainer store={store} />);
});

it('maps state and dispatch to props', () => {
  expect(wrapper.props().jenUbytovani).toBe(true);
  expect(wrapper.props().textFilter).toEqual('');
  expect(wrapper.props().ubytovani).toBeTruthy();
  expect(wrapper.props().ubytovani).toMatchSnapshot();
});

it('maps onUbytovaniChange to dispatch changeUbytovani action', () => {
  wrapper.props().onUbytovaniChange();

  expect(store.dispatch).toHaveBeenCalledWith({ type: 'UBYTOVANI_CHANGE_UBYTOVANI' });
});

it('maps onTextFilterChange to dispatch textFilterChange action', () => {
  wrapper.props().onTextFilterChange('Kl');

  expect(store.dispatch).toHaveBeenCalledWith({
    type: 'UBYTOVANI_TEXT_FILTER_CHANGE',
    textFilter: 'Kl'
  });
});

it('maps onSelect to dispatch saveUbytovani action', () => {
  wrapper.props().ubytovani[0].akce.onSelect({ target: { value: 'Odhlásit' } });

  expect(store.dispatch).toHaveBeenCalledWith(expect.any(Function));
});
{'fraction_non_alphanumeric': 0.1597777005904828, 'fraction_numerical': 0.0003473428273706148, 'mean_word_length': 4.853658536585366, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '4260719', 'n_tokens_mistral': 969, 'n_tokens_neox': 956, 'n_words': 166}