没有为键"仪表板提供减速器"

时间:2017-08-14 06:33:02

标签: redux mocha react-redux

当我在我的测试中尝试用户存储时

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>
    )
  })

但是我没有为密钥&#34;仪表板提供减速器&#34; 这是我的configStore主要代码

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

我有PageLogin,但无法获得仪表板 并且有仪表板主要代码

export {
  snackbarActions,
  dialogActions,
  userConfigActions,
  authActions,
  progressActions,
  UserProfileActions,
  // ...
};

1 个答案:

答案 0 :(得分:1)

您需要使用combineReducers来组合缩减器

import { combineReducers } from 'redux'

const reducer = combineReducers({
  dashboard,
  PageLogin,
})