0
假设我有一个减速器文件减速器/ group1.js这样单元测试减速器,测试每个减速器或组合减速器?
export default combineReducers({
A: combineReducers({ A1, A2 }),
B: reducerB,
C: reducerC
})
有测试每个切片减速器(A1,A2,和reducerB reducerC)和测试组合一个之间的任何差异?
import group1 from 'reducers/group1'
describe('reducers',() => {
describe('group1',() => {
it('should provide the initial state',() => {
expect(group1(undefined, {})).to.equal({ group1: { A: { ... }, B: ... } })
})
it(...)
// ...
})
})
或
import { A1, A2, reducerB, reducerC } from 'reducers/group1'
describe('reducers',() => {
describe('group1',() => {
describe('A1',() => {
it('should provide the initial state',() => {
expect(A1(undefined, {})).to.equal(0) // if A1 is just a number
})
})
describe('A2',() => { ... })
describe('reducerB',() => { ... })
describe('reducerC',() => { ... })
})
})