Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Catch rejected Promise from Action #39

Open
dave-irvine opened this issue May 2, 2018 · 3 comments
Open

How to Catch rejected Promise from Action #39

dave-irvine opened this issue May 2, 2018 · 3 comments

Comments

@dave-irvine
Copy link

If I have an Action that returns a Promise which may either resolve or reject (redux-form requires this for form submission), how can I write a test that handles the error case? Currently if I reject a Promise the tests are crashing out.

With redux-mock-store you could do this:

store.dispatch(actionA()).catch((err) => { expect(err)...... });

But I can't find a way to do this with this library. Any clues?

@fernandoabolafio
Copy link

@dave-irvine did you figure it out? I am currently facing the same issue.

@dave-irvine
Copy link
Author

No sorry I didn't find a solution

@dmitry-zaets
Copy link
Member

Unfortunately wit the current implementation it expects for all the nested actions to return a resolved promise only:
https://github.com/redux-things/redux-actions-assertions-js/blob/78a5fefba99034d38b6454731cc5b167e100e373/src/asserts/utils/unrollActions.js#L13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants