Skip to content

test: +29 unit tests across the recently-touched areas (37 → 66)#13

Closed
fabiodalez-dev wants to merge 1 commit into
feat/sentry-crash-reportingfrom
test/coverage-touched-areas
Closed

test: +29 unit tests across the recently-touched areas (37 → 66)#13
fabiodalez-dev wants to merge 1 commit into
feat/sentry-crash-reportingfrom
test/coverage-touched-areas

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

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.

File Tests Covers
CatalogDaoEdgeTest 5 Room cache: empty replaceAll clears, position ordering, snapshot swap, count-after-clear, 50-item batch
CachedBookMapperEdgeTest 5 entity↔summary: all-null & full round-trips, position/id independence, availability flags
BookSummaryEdgeTest 4 availability boundaries (1 / 0 / negative copies), authorsLabel
StatusMappingMoreTest 7 loan()/reservation() colour buckets + title-cased fallback, loanGroup() priority ordering
DateFormatMoreTest 3 offset timestamp, unparseable passthrough, todayIso
NetworkUrlMoreTest 4 port kept, origin derivation, http loopback/emulator allowed vs public http rejected
CatalogSyncWorkerTest 1 WorkManager worker degrades to a successful no-op (via work-testing)

Adds androidx.work:work-testing as a test dependency.

Verified

testDebugUnitTest 66/66 green.

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.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d58983b1-8752-42b7-9b50-771605800ff8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/coverage-touched-areas

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.
@fabiodalez-dev

Copy link
Copy Markdown
Owner Author

Landed in main via the integrated stack merge (main @ 754d25e). Every commit of this branch is now reachable from main; the review fixes were applied on top in the same integration (see commit 754d25e). Closing as merged.

@fabiodalez-dev fabiodalez-dev deleted the test/coverage-touched-areas branch July 2, 2026 14:43
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.

1 participant