Skip to content

Conversation

@sudokoi
Copy link
Owner

@sudokoi sudokoi commented Nov 27, 2025

  • feat(tests): add more tests to improve coverage
  • refactor: extract side-effect abstractions for testability and improve coverage

…e coverage

- Add `app_deps.rs` module with injectable trait interfaces (GitHubApi, PromptInterface, RateLimiterInterface)
- Implement factory pattern (GitHubApiFactory) for dependency injection
- Refactor `App::run()` to delegate to `App::run_with_deps()` with injected dependencies
- Add `async-trait` dependency for async trait method support
- Replace direct function calls with trait method calls in business logic
- Add `tests/app_run_with_deps_tests.rs` with mock implementations for integration testing
- Improve overall coverage from 56.85% to 66.18% (+9.33%), with `src/app.rs` reaching 48% (+38.07%)

Changes enable:
- Testable main logic via dependency injection (MockGitHubApi, MockPrompt, MockRateLimiter)
- Separation of side effects from pure business logic
- Future addition of error path tests and CI coverage gates
@sudokoi sudokoi changed the title feat: improve test coverage, refactor code to make it more testabe refactor: extract side-effect abstractions for testability and improve coverage Nov 27, 2025
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 44.06780% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.42%. Comparing base (445a6f0) to head (1508f8e).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/app_deps.rs 0.00% 21 Missing ⚠️
src/app.rs 80.00% 6 Missing ⚠️
src/prompt.rs 25.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
+ Coverage   57.69%   62.42%   +4.73%     
==========================================
  Files          10       11       +1     
  Lines         728      857     +129     
==========================================
+ Hits          420      535     +115     
- Misses        308      322      +14     
Flag Coverage Δ
unittests 62.42% <44.06%> (+4.73%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sudokoi sudokoi merged commit 1508f8e into main Nov 27, 2025
5 of 6 checks passed
@sudokoi sudokoi deleted the improve-tests branch November 27, 2025 05:49
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