[Repo Assist] test: add prefer_package and dedupe_packages edge-case tests (231→241)#170
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
Conversation
Add 7 unit tests for prefer_package covering all branch paths: - newer version wins - older version loses - equal versions: more metadata wins - equal versions: equal metadata keeps existing - unknown/empty version loses to real version - real version beats unknown - single source field tips the score Add 3 unit tests for dedupe_packages: - different sources are kept separately (not merged) - equal versions: entry with more metadata wins (available_version) - source comparison is case-insensitive (winget vs Winget) Also unify the status message ellipsis in handler.rs: use Unicode '…' for both the 'o' (homepage) and 'c' (changelog) open actions so the messages are visually consistent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
21 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
What
Adds 10 new unit tests covering two previously under-tested functions in
cli_backend.rs, plus a minor consistency fix inhandler.rs.prefer_package— 7 testsThis function decides which of two duplicate package entries to keep during deduplication. Previously it was only exercised indirectly through
dedupe_packages. New direct tests cover every branch:prefer_package_newer_version_winsprefer_package_older_version_losesprefer_package_equal_versions_more_metadata_winsprefer_package_equal_versions_equal_metadata_returns_falseprefer_package_unknown_version_loses_to_realprefer_package_real_version_beats_unknownprefer_package_equal_versions_one_source_field_winsdedupe_packages— 3 testsThe existing test only checked version ordering. New tests cover:
dedupe_packages_different_sources_are_kept_separatelydedupe_packages_keeps_entry_with_most_metadataavailable_versionwinsdedupe_packages_source_comparison_is_case_insensitivewingetandWingettreated as the same sourcehandler.rs— consistency fixThe
o(open homepage) action used"Opening {}..."(three ASCII dots) whilec(open changelog) used"Opening changelog {}..."(Unicode ellipsis...). Changed the homepage message to also use...for visual consistency.Why
prefer_packagecontains non-trivial branching logic (version comparison + metadata scoring) that wasn't directly tested. These tests document the contract and catch regressions.dedupe_packagescross-source and metadata-score cases are real production paths exercised whenwinget listreturns the same package from multiple sources.Test Status