Add comprehensive test coverage for diff formatting and comparison#37
Merged
fullstackjam merged 2 commits intomainfrom Apr 19, 2026
Merged
Add comprehensive test coverage for diff formatting and comparison#37fullstackjam merged 2 commits intomainfrom
fullstackjam merged 2 commits intomainfrom
Conversation
- diff: add direct tests for ToSet and PluginsEqual (previously untested) - diff: cover HasChanges/TotalChanged dotfiles (dirty, unpushed, repoChanged) and shell branches; all previously untested code paths - diff: add FormatTerminal tests for dotfiles and shell sections (all printDotfilesSection / printShellSection branches exercised) - diff: add FormatJSON tests verifying shell, dotfiles, and dev_tools keys appear in output with correct summary counts - diff: add CompareSnapshotToRemote test with macOS prefs in remote config - diff: add diffDotfiles tests for .git suffix normalization, empty-reference no-change guarantee, and distinct-URL change detection - search: add getAPIBase tests covering default URL, valid HTTPS override, valid localhost override, and disallowed HTTP non-loopback fallback - permissions: test OpenScreenRecordingSettings non-darwin stub returns nil https://claude.ai/code/session_01TfJCwVRqyyW8dcfxs57Y1v
|
👋 Thanks for opening this pull request! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
… case - permissions: merge TestHasScreenRecordingPermission_NonDarwin into _Returns (both asserted IsType on the same call); rename TestOpenScreenRecordingSettings_NonDarwin to _Returns for symmetry - diff: add inline comment on the duplicates-in-a PluginsEqual test case explaining why false is returned (set collapse, not length mismatch) https://claude.ai/code/session_01TfJCwVRqyyW8dcfxs57Y1v
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What does this PR do?
Adds extensive unit test coverage for diff formatting (terminal and JSON output), diff result calculations, dotfiles/shell comparison logic, and API base URL handling.
Why?
This PR significantly improves test coverage across multiple packages:
HasChanges(),TotalChanged()calculations, and utility functions (ToSet,PluginsEqual)getAPIBase()environment variable handling and URL validationThese tests ensure correctness of diff calculations, proper handling of empty/nil sections, and secure API URL configuration.
Testing
go vet ./...passesNotes for reviewer
Key test scenarios covered:
TotalChanged()correctly counts changes across multiple sectionsPluginsEqual()handles order-independent comparisongetAPIBase()validates URLs and rejects plain HTTP to non-loopback hostshttps://claude.ai/code/session_01TfJCwVRqyyW8dcfxs57Y1v