Skip to content

Add unit tests for uncovered helper methods and edge cases#264

Merged
arncore merged 1 commit intomainfrom
test/increase-unit-test-coverage
Apr 3, 2026
Merged

Add unit tests for uncovered helper methods and edge cases#264
arncore merged 1 commit intomainfrom
test/increase-unit-test-coverage

Conversation

@arncore
Copy link
Copy Markdown
Owner

@arncore arncore commented Apr 3, 2026

Summary

Adds 18 new unit tests across 6 files, targeting previously untested branches in the unit-testable code. Covers helper methods added in recent refactoring PRs and edge cases in parsing/validation logic.

New tests

File Tests added What's covered
manifest.rs 4 DependencySpec::is_maven() — all 4 combinations
lockfile.rs 2 Lockfile::has_maven_entry() — finds maven, ignores path
maven.rs 7 parse() empty parts, maven_artifact_url(), cache_path delegation
targets/lib.rs 3 is_host() true/false, Display matches to_konanc_arg
plugin.rs 1 ensure_plugin_artifacts locked mode without hash
error.rs 1 map_artifact_download_err pass-through for non-download errors

Coverage impact

  • Overall: 62.4% → 62.7% (dominated by I/O-heavy files)
  • Unit-testable files: ~90.7% (6 files at 100%, 5 at 92-97%)
  • Remaining gaps are I/O error paths (file open/read failures, HTTP errors, compiler execution) that require mocking infrastructure to test

Test plan

  • cargo test --workspace — 771/771 tests pass (+18 new)
  • cargo clippy --workspace -- -D warnings — 0 warnings
  • cargo fmt --all -- --check — clean
  • CI passes

🤖 Generated with Claude Code

- Add tests for `DependencySpec::is_maven()` (4 cases: both set, maven
  only, version only, path dep)
- Add tests for `Lockfile::has_maven_entry()` (finds maven dep, ignores
  path deps, returns false for missing)
- Add tests for `MavenCoordinate::parse()` edge cases (empty group,
  empty artifact, empty version, empty packaging)
- Add tests for `maven_artifact_url()` (pom and module extensions)
- Add test for `cache_path` delegation to `repository_path`
- Add tests for `Target::is_host()` (true for host, false for other)
- Add test for `Target::display` matches `to_konanc_arg`
- Add test for `ensure_plugin_artifacts` locked mode error path
- Add test for `map_artifact_download_err` pass-through of other errors

18 new tests across 6 files, covering previously untested branches
in the unit-testable code paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 96.62162% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/konvoy-targets/src/lib.rs 86.36% 3 Missing ⚠️
crates/konvoy-engine/src/error.rs 81.81% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@arncore arncore merged commit 6b38a4b into main Apr 3, 2026
18 checks passed
@arncore arncore deleted the test/increase-unit-test-coverage branch April 3, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants