-
Notifications
You must be signed in to change notification settings - Fork 121
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
test: replace mocks with snapshots #1220
test: replace mocks with snapshots #1220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - This changing to snapshots makes sense to me especially in terms of the context of changing the data logic for the null values in tooltips PR. I think it should be manageable as a team for us to check any snapshot changes in a PR in future reviews (to make sure snapshots aren't being changed for bad reasons).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
packages/charts/src/chart_types/xy_chart/rendering/rendering.bands.test.ts
Outdated
Show resolved
Hide resolved
🎉 This PR is included in version 31.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
We use mocks for checking the equality of very big objects.
The PR refactored that code using snapshot instead: they provide the same functionality with less burden.
Details
This can simplify the refactoring in the following cases:
If we are testing an object structure, we probably can benefit directly from snapshots instead of manually writing the object.
The only caveat is to threat snapshots as code, checking them during the review as they where written inline in the test