mardi 17 mars 2020

Enzyme mount breaks with this redux store setup

Hi can you help please.

Why do my tests break with this redux store setup. It has something to do with the way I am setting up the initial state and compose.

Here is my repo: https://github.com/code-in-time/react-testing-learn-

import React from 'react'
import { Provider } from 'react-redux'
import { createStore, compose, applyMiddleware } from 'redux'
import reducers from './Reducers'
import reduxPromise from 'redux-promise'

const store = (initialState) => createStore(
  reducers,
  initialState,
  compose(
    applyMiddleware(
      reduxPromise
    ),
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  )
);

export default ({children, initialState ={}}) => (
  <Provider store={store(initialState)}>
    {children}
  </Provider>
);

Thanks

Aucun commentaire:

Enregistrer un commentaire