-
Notifications
You must be signed in to change notification settings - Fork 594
refactor(general): use testify in content_formatter_test.go
#4775
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4775 +/- ##
==========================================
+ Coverage 75.86% 76.36% +0.50%
==========================================
Files 470 530 +60
Lines 37301 40443 +3142
==========================================
+ Hits 28299 30886 +2587
- Misses 7071 7512 +441
- Partials 1931 2045 +114 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7f8b036 to
ad30a9b
Compare
IterateUnreferencedPacks for claritycontent_formatter_test.go
ad30a9b to
7d2a33a
Compare
7d2a33a to
f31ae72
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.
Pull Request Overview
This PR refactors test code to use the testify library instead of manual error checking and assertions. The changes replace traditional Go testing patterns with testify's require and assert functions for cleaner, more consistent test code.
Key changes:
- Replace manual error checking with
require.NoError()andrequire.NoErrorf() - Replace manual byte slice comparisons with
assert.Equal()andrequire.Equalf() - Simplify test logic by removing complex goroutine-based flushing in favor of a simple loop
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| repo/content/content_manager_test.go | Refactors parallel write test to use testify assertions and simplifies flushing logic |
| repo/content/content_formatter_test.go | Converts manual error checks and comparisons to testify assertions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| fop, err := format.NewFormattingOptionsProvider(f, nil) | ||
| assert.NoError(t, err) | ||
| require.NoError(t, err) |
Copilot
AI
Sep 12, 2025
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.
[nitpick] This change from assert.NoError to require.NoError is inconsistent with the pattern used elsewhere in this function. Since this is a helper function that creates a format provider, using require is appropriate as failure should stop test execution, but the original assert was also valid. Consider maintaining consistency with the assertion style used in the rest of the test.
No description provided.