<commit_before>import React from 'react'
import { createMockStore, createMockDispatch } from 'redux-test-utils'
import {shallow} from 'enzyme'
import toJson from 'enzyme-to-json'
import configureStore from 'redux-mock-store'
import ForecastHourlyContainer from './ForecastHourlyContainer'
import {getForecastHourly} from './forecastHourlyActions'
import location from '../../app/location'
import { createMomentId } from '../../app/utility'

describe('<ForecastHourlyContainer />', () => {
  it('should render', () => {
    const initialState = {
      forecastHourlyReducer: {
        forecastHourly: {
          data: [],
          app: {
            locationId: location().locationId, // nyc usa
            isFetching: false
          },
          ui: {
            selectedDate: createMomentId(Date.now()),
            activeReportType: 'summary'
          }
        }}
    }
    const mockStore = configureStore()
    const store = mockStore(initialState)
    const wrapper = shallow(<ForecastHourlyContainer store={store} />)
    expect(toJson(wrapper)).toMatchSnapshot()
  })

  it('should dispatch', () => {
    const state = 'state'
    const store = createMockStore(state)
    const action = getForecastHourly(location().locationId)

    store.dispatch(action)
    expect(store.getAction(action.type)).toEqual(action)
    expect(store.getActions()).toEqual([action])
    expect(store.isActionDispatched(action)).toBe(true)
    expect(store.isActionTypeDispatched(action.type)).toBe(true)
    expect(store.getState()).toBe(state)

    const dispatchMock = createMockDispatch()
    dispatchMock.dispatch(action)
    expect(dispatchMock.getAction(action.type)).toEqual(action)
    expect(dispatchMock.getActions()).toEqual([action])
    expect(dispatchMock.isActionDispatched(action)).toBe(true)
    expect(dispatchMock.isActionTypeDispatched(action.type)).toBe(true)
  })
})<commit_msg>Add test case dispatch to ForecastHourlyContainer<commit_after>import React from 'react'
import { createMockStore, createMockDispatch } from 'redux-test-utils'
import {shallow} from 'enzyme'
import toJson from 'enzyme-to-json'
import configureStore from 'redux-mock-store'
import ForecastHourlyContainer from './ForecastHourlyContainer'
import {getForecastHourly, setForecastHourlyActiveReportType} from './forecastHourlyActions'
import location from '../../app/location'
import { createMomentId } from '../../app/utility'

describe('<ForecastHourlyContainer />', () => {
  it('should render', () => {
    const initialState = {
      forecastHourlyReducer: {
        forecastHourly: {
          data: [],
          app: {
            locationId: location().locationId, // nyc usa
            isFetching: false
          },
          ui: {
            selectedDate: createMomentId(Date.now()),
            activeReportType: 'summary'
          }
        }}
    }
    const mockStore = configureStore()
    const store = mockStore(initialState)
    const wrapper = shallow(<ForecastHourlyContainer store={store} />)
    expect(toJson(wrapper)).toMatchSnapshot()
  })

  it('should dispatch action getForecastHourly', () => {
    const state = 'state'
    const store = createMockStore(state)
    const action = getForecastHourly(location().locationId)

    store.dispatch(action)
    expect(store.getAction(action.type)).toEqual(action)
    expect(store.getActions()).toEqual([action])
    expect(store.isActionDispatched(action)).toBe(true)
    expect(store.isActionTypeDispatched(action.type)).toBe(true)
    expect(store.getState()).toBe(state)

    const dispatchMock = createMockDispatch()
    dispatchMock.dispatch(action)
    expect(dispatchMock.getAction(action.type)).toEqual(action)
    expect(dispatchMock.getActions()).toEqual([action])
    expect(dispatchMock.isActionDispatched(action)).toBe(true)
    expect(dispatchMock.isActionTypeDispatched(action.type)).toBe(true)
  })

  it('should dispatch action setForecastHourlyActiveReportType', () => {
    const state = 'state'
    const store = createMockStore(state)
    const action = setForecastHourlyActiveReportType('details')

    store.dispatch(action)
    expect(store.getAction(action.type)).toEqual(action)
    expect(store.getActions()).toEqual([action])
    expect(store.isActionDispatched(action)).toBe(true)
    expect(store.isActionTypeDispatched(action.type)).toBe(true)
    expect(store.getState()).toBe(state)

    const dispatchMock = createMockDispatch()
    dispatchMock.dispatch(action)
    expect(dispatchMock.getAction(action.type)).toEqual(action)
    expect(dispatchMock.getActions()).toEqual([action])
    expect(dispatchMock.isActionDispatched(action)).toBe(true)
    expect(dispatchMock.isActionTypeDispatched(action.type)).toBe(true)
  })
})
{'fraction_non_alphanumeric': 0.12991959373677528, 'fraction_numerical': 0.0, 'mean_word_length': 4.044823906083244, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2367388', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1368, 'n_words': 221}