Say I have several reducer functions and I combine them all into one reducer using combineReducers(...)
, is there a way of testing what reducers the combined reducer actually contains?
For example, if I have this:
import { combineReducers } from 'redux'
const reducer1 = (state, action) => {...}
... (more reducers, etc)
const rootReducer = combineReducers({
reducer1,
reducer2,
reducer3
})
export default rootReducer
Can I write a test with Mocha and Expect.js that will enable me to check if the rootReducer
contains say reducer2
? Is this even possible?
The way I currently have my project set up is that each reducer is in a separate file and is then imported into the file where the combineReducers(...)
function is used to combine them all. I am testing all the individual reducers to check that they do what they should, but I also thought it would be a good idea to test the combined reducer to make sure that it contains all the other reducers that it should (in case I forget to add one for example).
Thanks
finalReducers
orreducers
), so "no" i think is your direct answer. all it returns is a function that loops and calls all the individuals... – Loeb