我尝试测试我的saga
,但我在测试select
时遇到了一些问题。
我想从reselect
中模拟createSelector
,但我不能这样做,因为我有这个错误:
Cannot read property 'module' of undefined
我的重新选择:
//R - is ramda
export const selectFilters = createSelector(R.path(['notification', 'filters']), (filters) => filters)
我的传奇:
//module gives me error because selectFilters returns undefined
const {module, orderByDate} = yield select(selectors.selectFilters())
您必须将select
效果传递给选择器的引用。在您的传奇中,您实际上是在调用选择器,然后传递返回值。如果你做得好,你不必模拟选择器。
像这样修改代码以修复错误:
const {module, orderByDate} = yield select(selectors.selectFilters)