Closed carljohnson93 closed 4 years ago
I've figured out that it's impossible to observe canceled task because of lack of direct control on next
value of generator, when using expectSaga
. Better solution that I've found is to use race
, it works same for my purpose, less verbose, automatically cancels loser task, and it can be tested with expectSaga
.
describe('timerSaga', () => {
it('should watch start and race stop action and timer task', () => {
return expectSaga(timerSaga)
.race([
call(timer),
take('STOP')
])
.dispatch(start())
.run()
})
})
How do I write assertion for saga if it cancels forked task? I tried but it throws that there's no
cancel
method.