Repository navigation
Cover the service implementations offline - #216
Merged
Merged
Conversation
Governance, account, block and pool had only live integration suites. The mainnet ones are excluded from the coverage job, so GovernanceServiceImpl reported 5.5% despite being exercised nightly, and none of those suites can assert what request was actually sent. Adds MockWebServer suites for all four. They check that each method reaches the endpoint it should, that bulk calls POST their ids in the body, that epoch filters reach the query or body, that a null Options does not NPE, and that invalid input is rejected before any request leaves the client - asserted with getRequestCount() == 0 rather than assumed. GovernanceServiceImpl 5.5% -> 98.2% overall lines 81.8% -> 92.3% overall branches 71.2% -> 78.8% 17 tests, all offline, adding roughly 8 seconds to the suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #216 +/- ##
=============================================
+ Coverage 77.83% 88.13% +10.30%
- Complexity 298 337 +39
=============================================
Files 37 37
Lines 961 961
Branches 79 79
=============================================
+ Hits 748 847 +99
+ Misses 175 74 -101
- Partials 38 40 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Governance, account, block and pool had only live integration suites. Two consequences:
GovernanceServiceImplreported 5.5% despite being exercised nightly. The number was measuring the test selection, not the code.Change
MockWebServersuites for all four services, following the pattern from #205.They assert that each method reaches the endpoint it should, that bulk calls POST their ids in the body, that epoch filters actually reach the query string or body, that a null
Optionsdoes not NPE, and that invalid input is rejected before any request leaves the client — verified withserver.getRequestCount() == 0rather than assumed.Coverage
GovernanceServiceImpl17 tests, all offline, about 8 seconds added to the suite. Nothing here can flake on a live Koios instance or contribute to rate limiting.
What is deliberately left
BaseServicekeeps 26 uncovered lines, nearly all of them the sevenSystem.getenvbranches in its constructor.getenvis immutable in-process, so covering them means subprocesses per permutation or a seam added to production code purely for tests. The remaining service impls are single-digit gaps not worth the noise.🤖 Generated with Claude Code