Skip to content

Any examples for thunk middleware dispatching #21

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

Closed
vojtatranta opened this issue Sep 28, 2015 · 1 comment
Closed

Any examples for thunk middleware dispatching #21

vojtatranta opened this issue Sep 28, 2015 · 1 comment

Comments

@vojtatranta
Copy link

Do we know about any real-world examples of testing async action creators?
I struggle to test creators like this:

function add(entity) {
  return dispatch => {
    dispatch({
     type: ADD,
    payload: entity
   })
  }
}

I looked at test here, but it gave me no clue.
Do I have to mock dispatch function or something?

@gaearon
Copy link
Collaborator

gaearon commented Sep 28, 2015

It depends on what you want to test. Mocking dispatch is reasonable.
Please see reduxjs/redux#546.

@gaearon gaearon closed this as completed Sep 28, 2015
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

2 participants