-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Snapshots not storing function names in Saga objects #2580
Comments
I thought it was a bug, but we actually have this behaviour on purpose: https://github.com/facebook/jest/blob/master/packages/jest-snapshot/src/utils.js#L65 @cpojer why would we do that? |
The problem is that function names are not reliable and they also aren't visible in the real user output. It's like testing a private function of a module – if it is important, you should expose it somehow. Concrete examples where this creates issues:
See http://facebook.github.io/jest/blog/2016/10/03/jest-16.html#snapshot-updates |
Thank you Christoph! Is there another way to test Saga call actions then, using snapshot, or do you just recommend not using it for those? |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When I run a test against a Redux Saga Call event, If I want to store the result in a snapshot, the function name being called is important. However, currently when I store it as a snapshot, the function name isn't serialized into the snapshot.
For a test:
Here is what gets put into the snapshot:
However, this is what the test says in the console that it is comparing against when I don't use a snapshot:
Note the
Function fetchCall
. Without that function name, the snapshot will pass easily for any functionsThe text was updated successfully, but these errors were encountered: