Given a saga that operates over the action payload, where action
has been passed in by takeLatest
e.g.
export function* mySaga(action) {
try {
yield all(action.payload.items.map(p => call(doSomething, p)));
}
yield put(actionSuccess());
} catch (error) {
yield put(actionFailed(error));
}
}
export function* watchMySaga() {
yield takeLatest(AN_ACTION, mySaga);
}
how do I mock action
in my redux-saga-test-plan
test for mySaga
? As action.payload
is undefined
, my test currently throws an error.