DEV Community

loading...

Discussion on: The best way to test Redux Sagas

Collapse
royb0y profile image
Roy

This is a great article! Thank you for this!

How would you throw exceptions to test for api call failures?

For example, if you had a try / catch block for,

const profile = yield call(getProfile, action.profileId);

When you test the saga as a whole, how do you force an error?

I tried using to mockImplementation to return a new Error(), but that doesn't go into the catch block.