Skip to content

test: cover BibleVersion lookup fallbacks#196

Open
davidfedor wants to merge 1 commit into
mainfrom
codex/calculate-code-coverage-for-youversionplatformcore
Open

test: cover BibleVersion lookup fallbacks#196
davidfedor wants to merge 1 commit into
mainfrom
codex/calculate-code-coverage-for-youversionplatformcore

Conversation

@davidfedor

@davidfedor davidfedor commented Jul 13, 2026

Copy link
Copy Markdown
Member

Motivation

  • BibleVersion contains SDK-facing lookup and fallback logic (book-code fallback, reference parsing, RTL detection, equality/hash) that was under-tested and important for correct behavior when metadata is missing or partial.
  • Add concise, focused tests that exercise the interesting and risky behaviors rather than broad, pedantic coverage of deprecated/infra code.

Description

  • Added new unit tests in Tests/YouVersionPlatformCoreTests/BibleVersionTests.swift to cover book-code fallback, missing metadata lookup failures, short USFM rejection, unknown chapter labels, text-direction RTL detection, and ID-based equality/hash semantics.
  • Introduced small test helpers (versionWithBookCodes, versionWithoutBookMetadata, versionWithTextDirection, versionWithId, and book(...)) to build minimal BibleVersion/BibleBook inputs without relying only on the large fixture.
  • Kept tests narrowly scoped to behaviors that are valuable for consumers and for preventing regressions in BibleVersion lookup logic.

Testing

  • Ran swift test --enable-code-coverage --filter YouVersionPlatformCoreTests and merged profiles with llvm-profdata/llvm-cov; overall YouVersionPlatformCore coverage reported at ~80.44% and BibleVersion region coverage increased to 96.88% (line coverage for BibleVersion reported ~75.61%).
  • Ran full test suite with swift test and the focused tests passed (test run completed successfully).
  • Ran swiftlint --strict (via the Linux binary) and found 0 lint violations.

Codex Task

Greptile Summary

This PR adds focused tests for BibleVersion fallback and lookup behavior.

  • Coverage for missing and empty book-code fallbacks.
  • Checks for missing metadata, unknown books, and short references.
  • Tests for RTL detection and ID-based equality/hash behavior.
  • Small private helpers for minimal BibleVersion and BibleBook fixtures.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
Tests/YouVersionPlatformCoreTests/BibleVersionTests.swift Adds targeted BibleVersion tests and private fixture helpers with no concrete issues found.

Reviews (1): Last reviewed commit: "test: cover BibleVersion lookup fallback..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

✅ Commit Lint: passed

All commit messages in this PR conform to Conventional Commits.

📦 Release preview: v5.3.0 (no bump)

These commits do not trigger a version bump. The published version on main would remain v5.3.0.

Release analyzer output
[analyzer] Analyzing commit: test: cover BibleVersion lookup fallbacks
[analyzer] The commit should not trigger a release
[analyzer] Analysis of 1 commits complete: no release

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage Report

Coverage after merging codex/calculate-code-coverage-for-youversionplatformcore into main will be
92.30%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/DerivedData/Build/Intermediates.noindex/YouVersionPlatform.build/Debug-iphonesimulator/YouVersionPlatformCoreTests.build/DerivedSources
   resource_bundle_accessor.swift87.50%100%75%88.89%19, 44–45
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore
   YouVersionPlatformConfiguration.swift90.99%100%80%92.71%145–147, 39–41
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs
   URLBuilder.swift88.70%100%90%88.54%110–119, 12–19
   URLRequest+YouVersion.swift100%100%100%100%
   YouVersionAPI.swift92.93%100%90%93.26%10–11, 75, 83, 85, 9
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Bible
   BibleVersionAPI.swift73.50%100%66.67%74.51%118–132, 37–39, 58, 65–67, 75, 87
   BibleVersions.swift93.06%100%100%92.06%32, 54, 60–61, 83
   Highlights.swift77.71%100%59.09%80.39%109–116, 158, 161, 180, 183, 212, 215, 223, 227, 260–262, 63, 67, 79, 97
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/DataExchange
   DataExchange.swift97.37%100%100%97.14%39
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Languages
   Languages.swift92.75%100%85.71%93.55%47–49, 79
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Organizations
   Organizations.swift37.04%100%33.33%37.50%29–39, 41–43, 51
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Users
   SignInWithYouVersionPKCEAuthorizationRequest.swift81.25%100%73.68%82.40%100, 111, 122–129, 137, 75–81, 99
   SignInWithYouVersionPermission.swift69.77%100%60%71.05%18, 20, 22, 26, 39, 50–51, 53–56
   SignInWithYouVersionResult.swift39.68%100%20%43.40%15–17, 44–56, 83–91
   Users.swift74.13%100%67.74%75%112, 150–156, 16, 161, 17, 171, 18–20, 208, 21, 211, 228, 234, 252–254, 278–280, 282–284, 286–288, 290–292, 297–299, 31–40, 44, 61, 67–71, 85
   YouVersionUserInfo.swift70.59%100%50%73.33%18, 29–31
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/VOTD
   VOTD.swift94.12%100%100%93.33%22
   YouVersionVerseOfTheDay.swift0%100%0%0%15–18, 20–25
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Bible
   BibleBook.swift100%100%100%100%
   BibleChapterRepository.swift85.26%100%82.76%85.83%111–113, 42, 49, 54–57, 65–68, 83
   BibleContentStorage.swift100%100%100%100%
   BibleHighlight.swift55.56%100%50%57.14%12–14
   BibleHighlightsCache.swift86.71%100%83.33%87.61%103–105, 117–118, 62, 65–67, 72
   BibleHighlightsRepository.swift77.78%100%69.23%78.98%144–148, 19–21, 220–221, 223–227, 23–25, 253–254, 256–260, 27–29, 31–32, 328–329, 33, 330–354, 381–383, 407–411
   BibleHighlightsViewModel.swift90.68%100%85.71%91.43%33–36, 66, 69, 73
   BibleReference.swift83.37%100%66.10%86.10%136, 231–232, 256, 260, 293, 306, 316, 326, 336, 338–349, 53–57, 67–69, 88, 90, 92
   BibleTextNode.swift92.86%100%75%95.83%
   BibleTextNodeParser.swift94.29%100%100%93.79%104, 150, 155, 173, 190, 44, 56–59
   BibleVersion.swift78.35%100%93.33%75.61%107–126
   BibleVersionRepository.swift86.30%100%83.02%87.03%125–128, 173, 212–217, 243, 248, 276–278, 71–74, 82–85
   DeprecatedBibleAPI.swift0%100%0%0%100, 102–104, 106–108, 110–112, 114–116, 119–121, 126, 128, 131–133, 138, 140, 142–144, 147–149, 27, 29–31, 36, 38, 40–42, 44–46, 48–50, 52–54, 56–58, 65–67, 69–71, 73–75, 77–79, 81–83, 85–87, 94–96, 98–99
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Logging
   YouVersionPlatformLogger.swift62.50%100%50%65.91%100, 56–58, 77–79, 90, 92, 94, 98
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Utilities
   AbbreviationSplitting.swift100%100%100%100%
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Tests/YouVersionPlatformCoreTests
   AbbreviationSplittingTests.swift100%100%100%100%
   BibleChapterRepositoryTests.swift98.68%100%94.12%99.25%
   BibleContentStorageTests.swift100%100%100%100%
   BibleHighlightsCacheTests.swift100%100%100%100%
   BibleHighlightsRepositoryTests.swift99.63%100%100%99.60%77, 87
   BibleHighlightsViewModelTests.swift94.06%100%92.11%94.34%19–25, 30, 38, 46, 85–87, 89–90
   BibleMetadataAPITests.swift100%100%100%100%
   BibleReferenceTests.swift100%100%100%100%
   BibleReferenceTests_adjacency.swift100%100%100%100%
   BibleReferenceTests_codable.swift100%100%100%100%
   BibleReferenceTests_contains.swift100%100%100%100%
   

@davidfedor
davidfedor marked this pull request as ready for review July 13, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant