test(ios-readplace): backfill untested logic seams and ratchet coverage#922
Closed
FagnerMartinsBrack wants to merge 1 commit into
Closed
test(ios-readplace): backfill untested logic seams and ratchet coverage#922FagnerMartinsBrack wants to merge 1 commit into
FagnerMartinsBrack wants to merge 1 commit into
Conversation
Cover error and edge paths that had no tests, and raise their coverage floors: - OAuthService (90%→98%): a malformed 200 body and a 200 missing refresh_token both surface .malformedResponse; refresh without a stored token throws .noRefreshToken and makes no request; revoke without a token skips the network but still clears. - AppSession completeSignIn (79%→83%): a callback carrying error= is denied, a callback with no code is .missingCode, and a failed code exchange surfaces as a failure — none exchanging or logging in. - ReadingListViewModel (94%→95%): a 401 whose refresh also fails routes to the logout callback without an error banner; a collection warning populates warningText. - KeychainTokenStorage (57%→98%): a real simulator-keychain round trip through the production path (add / read / update / remove, key isolation) — the test double never exercised it. - TokenStore (85%→99%): extract the embedded-provisioning-profile parsing into a pure `parseAppGroupId(fromProvisioningProfile:)` and cover it with fixtures (valid profile, no plist, no app-group entitlement, empty group array); the `Bundle.main` read stays the only untested line.
Member
Author
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.
Purpose
Several logic seams had error/edge paths with no coverage — the kind of gaps that surface as a silent regression. E3 covers them and ratchets the coverage floors up (the gate PR #920 seeded them at today's numbers).
What got covered (and the floors raised)
OAuthService.malformedResponse; 200 withoutrefresh_token→.malformedResponse; refresh with no stored token →.noRefreshToken(no request made); revoke with no token → skips the network, still clearsKeychainTokenStorageUserDefaultsdouble never exercised the Keychain codeTokenStoreparseAppGroupId(fromProvisioningProfile:)and covered it with fixtures (valid, no plist, no app-group entitlement, empty array); only theBundle.mainread stays untestedReadingListViewModelwarningTextAppSession(completeSignIn)error=is denied; a callback with nocodeis.missingCode; a failed code exchange surfaces as a failure — none logging inThe one production change is the
parseAppGroupIdextraction (behaviour-preserving) so the profile parsing is unit-testable without a realBundle.main.Still deferred (noted for a later ratchet)
HTMLCaptor's WKWebView state machine and the readerhtmxJS detector remain in the OS-boundary exclusions — covering them needs aJSContext/WebKit harness, a larger change than this backfill.AppSessionis at 83% (the remaining lines are the concurrent WebKit-wipe logout choreography).Testing
Full suite green with the gate active (242 tests, +15;
iOS coverage gate passed: 21 files at or above floor, 9 excluded), plus the STAGING smoke pass.