Created
June 22, 2017 23:23
-
-
Save PillowUnicorn/5db48d40caef79410f7655a960504157 to your computer and use it in GitHub Desktop.
Jest test for Redux actions [Template]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configureStore from 'redux-mock-store' | |
import * as activityActions from '../activity' | |
import { mock_activity } from '../../store/mock_data' | |
const middlewares = [] | |
const mockStore = configureStore( middlewares ) | |
const initialState = {} | |
const store = mockStore( initialState ) | |
beforeEach( () => { | |
store.clearActions(); | |
} ); | |
afterEach( () => { | |
expect( store.getActions() ).toMatchSnapshot(); | |
} ) | |
test( 'Dispatch fetchActivitySucceeded action', () => { | |
const { status, activity } = mock_activity | |
store.dispatch( activityActions.fetchActivitySucceeded( status, activity ) ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment