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

Testing middleware #3

Open
DFreds opened this issue Oct 12, 2018 · 2 comments
Open

Testing middleware #3

DFreds opened this issue Oct 12, 2018 · 2 comments

Comments

@DFreds
Copy link

DFreds commented Oct 12, 2018

How would you go about testing some of your middlewares?

@jitinsharma
Copy link
Owner

Middlewares can be triggered via action dispatch similar to reducer.

  • A basic example would be to do a simple action dispatch and using Mockito to check if certain methods are called or not(using Mockito.verify).
  • Building up on previous step, we could mock certain methods called inside middleware(like mocking a network/db call) and which would then do another dispatch to reducer and produce a new state.

@oliverspryn
Copy link

I'm pretty familiar with Mockito and unit testing, but I'm having a hard time seeing how this suggestion is a unit test. It sounds like more of an example of an integration test, where firing all of the related actions should eventually trigger the middleware. Is there an example you can provide?

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