Open kodmigor opened 2 years ago
Hi, everyone!
I have a saga with infinity loop, where it takes an action and depending on action's payload yield self cancellation. How this case may be tested correctly?
function* sagaWorker() { while (true) { const action = yield take("ACTION"); if (action.payload === "CANCEL") yield cancel(); } } test(`test SELF_CANCELLATION`, () => { const actionInProgress = {payload: "IN_PROGRESS", type: "ACTION"}; const actionCancel = {payload: "CANCEL", type: "ACTION"}; testSaga(sagaWorker) .next() .take("ACTION") .next(actionInProgress) .take("ACTION") .next(actionCancel) // what must be here? .next() .isDone(); });
Hi, everyone!
I have a saga with infinity loop, where it takes an action and depending on action's payload yield self cancellation. How this case may be tested correctly?