[test-improver] Improve tests for server/difc_log - #9362
Merged
Conversation
…anches Add TestBuildDIFCFilteredNotice_ItemWithDescOnly and TestBuildDIFCFilteredNotice_ItemWithReasonOnly to cover the two previously-untested branches in buildDIFCFilteredNotice (lines 150–154): - else if desc != : item has a description but no reason - else: item has a reason but no description buildDIFCFilteredNotice coverage: 87.5% → 100% internal/server package coverage: 92.4% → 92.6% Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves unit test coverage for internal/server’s DIFC notice rendering by adding targeted tests for previously uncovered branches in buildDIFCFilteredNotice, ensuring the notice formats items correctly when only a description or only a reason is present.
Changes:
- Added
TestBuildDIFCFilteredNotice_ItemWithDescOnlyto cover thedesc != "" && reason == ""formatting path. - Added
TestBuildDIFCFilteredNotice_ItemWithReasonOnlyto cover thedesc == "" && reason != ""formatting path.
Show a summary per file
| File | Description |
|---|---|
| internal/server/difc_log_test.go | Adds two new tests to exercise previously untested formatting branches in buildDIFCFilteredNotice. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Analyzed
internal/server/difc_log_test.goand found two uncovered branches inbuildDIFCFilteredNotice.File Analyzed
internal/server/difc_log_test.go(corresponding impl:internal/server/difc_log.go)Improvements Made
Added two new tests to cover previously-untested branches in
buildDIFCFilteredNotice(lines 150–154):TestBuildDIFCFilteredNotice_ItemWithDescOnly— exercises theelse if desc != ""branch: an item that has a description but no reason should appear inline using only the description.TestBuildDIFCFilteredNotice_ItemWithReasonOnly— exercises theelsebranch: an item that has a reason but no description should appear inline using only the reason.Coverage
buildDIFCFilteredNoticeinternal/serverpackageTest Output
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
awmgmcpgindex.crates.ioSee Network Configuration for more information.