Created
March 11, 2019 22:15
-
-
Save cladley/f5e5ae0487b4d637b71b4092187fd790 to your computer and use it in GitHub Desktop.
Simple test utils for jest redux
This file contains 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 { createStore, applyMiddleware } from "redux"; | |
import ReduxThunk from "redux-thunk"; | |
import rootReducer from "./reducers"; | |
export const middlewares = [ReduxThunk]; | |
const createStoreWidthMiddleware = applyMiddleware(...middlewares)(createStore); | |
export default createStoreWidthMiddleware(rootReducer); | |
///////////////////////////////////////////////////////////////////////////////////////////// | |
///////////////////////////////////////////////////////////////////////////////////////////// | |
///////////////////////////////////////////////////////////////////////////////////////////// | |
import { createStore, applyMiddleware } from "redux"; | |
import rootReducer from "../src/reducers"; | |
import { middlewares } from "../src/configureStore"; | |
export const storeFactory = initialState => { | |
const createStoreWithMiddleware = applyMiddleware(...middlewares)( | |
createStore | |
); | |
return createStoreWithMiddleware(rootReducer, initialState); | |
}; | |
export const findByTestAttr = (wrapper, val) => { | |
return wrapper.find(`[data-test="${val}"]`); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment