test: +29 unit tests across the recently-touched areas (37 → 66)#13
Closed
fabiodalez-dev wants to merge 1 commit into
Closed
test: +29 unit tests across the recently-touched areas (37 → 66)#13fabiodalez-dev wants to merge 1 commit into
fabiodalez-dev wants to merge 1 commit into
Conversation
Covers the offline-cache + sync + status/date logic we just added/changed; the suite goes from 37 to 66 green. - CatalogDaoEdgeTest (5): empty replaceAll clears, position ordering with non-sequential positions, snapshot swap, count-after-clear, 50-item batch. - CachedBookMapperEdgeTest (5): all-null and fully-populated round-trips, position vs id independence, availability-flag preservation. - BookSummaryEdgeTest (4): availability boundaries (1 copy, 0, negative), authorsLabel. - StatusMappingMoreTest (7): loan()/reservation() colour buckets + title-cased fallback, loanGroup() priority ordering and default. - DateFormatMoreTest (3): offset timestamp, unparseable dateTime passthrough, todayIso. - NetworkUrlMoreTest (4): explicit port, origin derivation, http loopback/emulator allowed vs public http rejected. - CatalogSyncWorkerTest (1): WorkManager worker degrades to a successful no-op under a non-Pinakes Application context (via work-testing TestListenableWorkerBuilder). Adds androidx.work:work-testing as a test dependency. Verified: testDebugUnitTest 66/66 green.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fabiodalez-dev
added a commit
that referenced
this pull request
Jul 2, 2026
- #11 CatalogSyncWorker: retry only TRANSIENT failures; give up (success) on permanent ones (401/403/app_disabled/validation/not_found) so the periodic chain isn't stuck retrying an unrecoverable condition. Classification is a pure isPermanentFailure() so it's unit-testable without Android/Hilt. - #13 CatalogSyncWorkerTest: rewritten — the old 'no-op on plain context' test was written for the pre-Hilt (ServiceLocator) worker and broke under #14's EntryPointAccessors migration. Now covers the real branch (permanent vs transient) via the pure function. - #9 HomeViewModel: don't flip loading=false on an empty cache emission — keep the skeleton until the first refresh resolves, so a cold start no longer flashes the 'empty library' state while the network is in flight. - #10 CI: build the release variant too (assembleRelease) so R8/minify is exercised in CI, not only at runtime. Merged the 7-PR stack (#8 navbar/reserve, #9 offline cache, #10 CI/R8, #11 WorkManager sync, #12 Sentry, #13 tests, #14 Hilt) into main; the libs.versions.toml conflict (#13 work-testing vs #14 Hilt libs) resolved as a union. Full build green: 67 unit tests, assembleDebug + assembleRelease.
Owner
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.
Fourth in the series. Stacked on #12 (Sentry) → #11 → #10 → #9, so the tests can reference the offline cache, the sync worker, and the rest.
What
29 new unit tests over the code we just added/changed. Suite grows 37 → 66 green.
CatalogDaoEdgeTestreplaceAllclears, position ordering, snapshot swap, count-after-clear, 50-item batchCachedBookMapperEdgeTestBookSummaryEdgeTestauthorsLabelStatusMappingMoreTestloan()/reservation()colour buckets + title-cased fallback,loanGroup()priority orderingDateFormatMoreTesttodayIsoNetworkUrlMoreTestCatalogSyncWorkerTestwork-testing)Adds
androidx.work:work-testingas a test dependency.Verified
testDebugUnitTest66/66 green.