-
Notifications
You must be signed in to change notification settings - Fork 486
test: format cassette bodies as pretty json #2393
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
Conversation
another-rex
left a comment
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.
Ah nice! I was just thinking of doing this.
| if !bytes.Equal(body2, []byte(i.Body)) { | ||
| if !bytes.Equal( | ||
| pretty.PrettyOptions(buffer.Bytes(), &pretty.Options{SortKeys: true}), | ||
| pretty.PrettyOptions([]byte(i.Body), &pretty.Options{SortKeys: true}), |
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.
I think this should actually be a cmp compare of the parsed output, rather than formatting both JSONs and doing a byte compare.
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.
could be, but what do you think of landing this as-is? just cause of its size and I've got a few other tweaks I'm planning to make which I do at the same time as moving to cmp (namely, I'm pretty sure we don't need to be touching some of the headers)
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.
Sure
5e2ca58 to
87dd406
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2393 +/- ##
==========================================
- Coverage 67.84% 67.75% -0.10%
==========================================
Files 172 172
Lines 13282 13291 +9
==========================================
- Hits 9011 9005 -6
- Misses 3565 3581 +16
+ Partials 706 705 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This should make it a lot easier to review changes to the cassettes