3

when i tried user store in my test

import React from 'react';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import { mount } from 'enzyme';
import chai from 'chai';
import App from '../layouts/App';
import store from '../redux/configureStore';
const expect = chai.expect;
// let store;
let app;
describe('login', () => {
  beforeEach(() => {
    app = mount (
      <Provider store={store}>
          <App />
      </Provider>
    )
  })

but i got No reducer provided for key "dashboard" here is my configStore main code

const reducer = {
  dashboard,
  PageLogin,
};
const store = createStore(
    reducer,
    composeEnhancers(applyMiddleware(sagaMiddleware))
  );

I got PageLogin, but can't got dashboard and there is dashboard main code

export {
  snackbarActions,
  dialogActions,
  userConfigActions,
  authActions,
  progressActions,
  UserProfileActions,
  // ...
};
巫大蝶
  • 31
  • 1
  • 2

1 Answers1

1

You need to use combineReducers to combine your reducers

import { combineReducers } from 'redux'

const reducer = combineReducers({
  dashboard,
  PageLogin,
})
hairmot
  • 2,975
  • 1
  • 13
  • 26