Cover ResponseAwareException fully - #5
Merged
Conversation
getResponse(), the lazy stream-read parse path, the integer error_code cast and the non-map errors branch were uncovered (50% of methods, 89.8% of lines). New tests cover them all, plus two that pin behavior the class exists for: - the pre-read $body wins over an already-drained response stream (the non-seekable-stream robustness described in the docblock) - the default message embeds a SANITIZED request context - query string and fragment stripped so consumer secrets never leak into messages ResponseAwareException: 8/8 methods, 100% lines. Suite MSI 80% -> 85%, covered MSI 82% -> 85%. The four remaining escaped mutants in the class are behaviorally equivalent (idempotent re-decode, trims of never-padded strings, sprintf's implicit string cast).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.x #5 +/- ##
============================================
+ Coverage 97.00% 98.50% +1.49%
Complexity 146 146
============================================
Files 24 24
Lines 401 401
============================================
+ Hits 389 395 +6
+ Misses 12 6 -6 ☔ 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.
Closes the coverage gap on
ResponseAwareException— previously 4/8 methods and 89.8% of lines; now 8/8 and 100%.What was uncovered
getResponse()— never called by any testparseBody()reading from the response stream when no$bodywas passed at construction (every SDK-internal throw passes$body, so only direct construction reaches it)getErrorCode()'s defensive int→string castgetValidationErrors()'s non-maperrorsbranchNew behavior pins
Two of the six new tests assert behavior this class exists for, which was exercised but never asserted:
$bodykeeps the getters working.Result