mercredi 1 juillet 2020

Cannot read property of getstate of undefined error in react testing

I am trying to write a very simple test case for the App component but getting "cannot read property getState of undefined" error in React.DOM.render line. I am new to testing.

App

const store = StoreConfig();

function App(props) {
  return (
    <Provider store={store}>
      <Home />
    </Provider>
  );
}

App.spec.js

it('renders correctly', () => {
  const div = document.createElement('div');
  ReactDOM.render(
    <Provider store={store}>
      <App />
    </Provider>,
    div
  );
  ReactDOM.unmountComponentAtNode(div);
});

Aucun commentaire:

Enregistrer un commentaire