-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
example tests #788
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
Comments
Woah, cool, thanks for taking a look at this! |
Sure, no problem. Maybe I didn't express myself properly tho. I'm having trouble writing tests for those kind of actions creators. mind providing some pointers? |
Can you explain the problem more specifically? Maybe I'm missing the point as to what exactly you're looking to test. |
Sure. I'm attempting to write a test for https://github.com/rackt/redux/blob/master/examples/real-world/actions/index.js#L3-L17 based on the action creators test example in the docs. But when I call The test example in the docs makes perfect sense, It's just not clear to me how I'd write a test for an action creator that uses a "custom" middleware. |
Oh, that's just because it puts the middleware-specific stuff behind a symbol. You can read it the same way it is written: import { CALL_API } from '../middleware/api';
import { fetchUser } from '../actions';
expect(fetchUser('svnlto')[CALL_API].endpoint).toEqual('/users/svnlto'); I'm not sure how useful it is to test these things, as tests will look pretty much the same as functions themselves. These are just descriptions after all. You might want to test the middleware itself instead. |
Yeah, thinking about it, this would make much more sense. |
I'm looking for help in creating tests for the 'real-world' example. Could you point out of the write tests for these kind of action creators?
The text was updated successfully, but these errors were encountered: