{"size": 1153, "ext": "js", "max_stars_repo_path": "src/components/TopicInfosButton/TopicInfosButton.test.js", "max_stars_repo_name": "geops/trafimage-maps", "max_stars_repo_stars_event_min_datetime": "2019-07-10T12:30:57.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-04T15:50:23.000Z", "max_issues_repo_path": "src/components/TopicInfosButton/TopicInfosButton.test.js", "max_issues_repo_name": "geops/trafimage-maps", "max_issues_repo_issues_event_min_datetime": "2019-07-09T11:23:55.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-24T12:27:42.000Z", "max_forks_repo_path": "src/components/TopicInfosButton/TopicInfosButton.test.js", "max_forks_repo_name": "geops/trafimage-maps", "max_forks_repo_forks_event_min_datetime": "2019-07-09T08:59:16.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-21T08:28:13.000Z"}
{"max_stars_count": 9, "max_issues_count": 962, "max_forks_count": 10, "avg_line_length": 26.2045454545, "max_line_length": 58, "alphanum_fraction": 0.5871639202}
import React from 'react';
import { mount } from 'enzyme';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import TopicInfosButton from '.';

describe('TopicInfosButton', () => {
  const mockStore = configureStore([thunk]);
  let store;

  test('renders active state', () => {
    const info = { key: 'foo' };
    store = mockStore({
      map: {},
      app: { activeTopic: info, selectedForInfos: {} },
    });
    const wrapper = mount(
      <Provider store={store}>
        <TopicInfosButton topic={info} />
      </Provider>,
    );
    expect(wrapper.find('Button').prop('className')).toBe(
      'wkp-info-bt wkp-active',
    );
  });

  test('renders selected and active state', () => {
    const info = { key: 'foo' };
    store = mockStore({
      map: {},
      app: { activeTopic: info, selectedForInfos: info },
    });
    const wrapper = mount(
      <Provider store={store}>
        <TopicInfosButton topic={info} />
      </Provider>,
    );
    expect(wrapper.find('Button').prop('className')).toBe(
      'wkp-info-bt wkp-active wkp-selected',
    );
  });
});
