【发布时间】:2019-08-19 05:32:04
【问题描述】:
我在史诗中有以下内容:
mergeMap(result => concat(
of(fetchDone(result)),
of(dispatchActions(payload))
))
和行动:
const fetchDone = result => ({ type: "FETCH_DONE", payload: result });
function dispatchActions(payload) {
return dispatch => {
dispatch(doStuff(payload));
...
};
}
问题出在我使用弹珠的测试中,我需要能够检查匿名函数,因为dispatchActions 被视为匿名函数。我该怎么做?
const values = {
...
b: { type: "FETCH_DONE", payload: expected },
c: NEEDS TO BE ANONYMOUS
};
...
const output$ = fetchApi(action$, state$);
// This fails due to the anonymous function
expectObservable(output$).toBe('---(bc)--', values);
【问题讨论】:
标签: redux-observable rxjs-marbles