Created
June 22, 2017 23:27
-
-
Save PillowUnicorn/fceb17e87ba31f2977294f5ce42bdc00 to your computer and use it in GitHub Desktop.
Jest test for Redux Reducers [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 errorsActions from '../../../actions/errors' | |
import { mock_errors } from '../../../store/mock_data' | |
import setErrorMessage from '../set_error_message' | |
import resetErrorMessage from '../reset_error_message' | |
const middlewares = [] | |
const mockStore = configureStore( middlewares ) | |
const initialState = {} | |
const store = mockStore( initialState ) | |
beforeEach( () => { | |
store.clearActions(); | |
} ); | |
test( 'Select setErrorMessage reducer', () => { | |
const { key, message } = mock_errors | |
const action = errorsActions.setErrorMessage( key, message ) | |
expect( setErrorMessage( undefined, action ) ).toMatchSnapshot(); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment