jfairbank / redux-saga-test-plan

Test Redux Saga with an easy plan.
http://redux-saga-test-plan.jeremyfairbank.com
MIT License
1.25k stars 127 forks source link

Support for yield cancel #359

Open brendt-napp opened 4 years ago

brendt-napp commented 4 years ago

Hello, I'd really like it if we could test something like the following

expectSaga(mySaga)
  .provide([
    [fork(otherSaga), fakeTaskObj]
  ])

  .fork(otherSaga)

  .cancel(fakeTaskObj)

my current workaround is to just use some helper functions and call those

export function cancelSelf() {
  return cancel();
}
export function cancelTasks(tasks = []) {
  return cancel(tasks);
}

and use them like so

expectSaga(mySaga)
  .provide([
    [fork(otherSaga), fakeTaskObj]
  ])

  .fork(otherSaga)

  .call(cancelTasks, fakeTaskObj)