Add unit tests for ApkArchitectureHelper#17
Conversation
📝 WalkthroughWalkthroughRefactors APK selection to return a sealed Changes
Sequence Diagram(s)sequenceDiagram
participant DetailActivity
participant ApkArchitectureHelper
participant AbiProvider
participant ApkSelectionResult
DetailActivity->>ApkArchitectureHelper: selectBestApk(assets)
ApkArchitectureHelper->>AbiProvider: supportedAbis()
AbiProvider-->>ApkArchitectureHelper: [abi1, abi2, ...]
ApkArchitectureHelper->>ApkArchitectureHelper: evaluate assets vs ABIs
alt Exact primary ABI match
ApkArchitectureHelper-->>ApkSelectionResult: ExactMatch(abi, asset)
else Universal APK match
ApkArchitectureHelper-->>ApkSelectionResult: Universal(asset)
else Secondary ABI fallback
ApkArchitectureHelper-->>ApkSelectionResult: Fallback(asset)
else Single asset only
ApkArchitectureHelper-->>ApkSelectionResult: Single(asset)
else No APKs found
ApkArchitectureHelper-->>ApkSelectionResult: NoApkFound
end
ApkSelectionResult-->>DetailActivity: selection result
DetailActivity->>DetailActivity: when(result) { setupInstallButton() / showViewRelease() }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@gradle/libs.versions.toml`:
- Line 22: Update the MockK dependency entries named "mockk" in the
libs.versions.toml to the latest stable release by changing their version
strings from "1.13.12" to "1.14.9"; locate both occurrences of the "mockk" key
(the one shown and the other occurrence later in the file) and replace the
version value so both references use "1.14.9".
🧹 Nitpick comments (2)
app/src/test/java/com/samyak/repostore/util/ApkArchitectureHelperTest.kt (2)
89-101: Misleading test method name.The method name
selectBestApk_returnsNullWhenNoApkAssetsis inaccurate since the method now returnsApkSelectionResult.NoApkFoundrather thannull. Consider renaming for clarity.Suggested rename
`@Test` - fun selectBestApk_returnsNullWhenNoApkAssets() { + fun selectBestApk_returnsNoApkFoundWhenNoApkAssets() { setSupportedAbis("arm64-v8a")
26-101: Consider adding a test for theSinglevariant.The
ApkSelectionResult.Singlevariant is returned when exactly one APK is present, but there's no dedicated test for this case. Adding coverage would ensure all branches are tested.Suggested test case
`@Test` fun selectBestApk_returnsSingleWhenOnlyOneApk() { setSupportedAbis("arm64-v8a") val assets = listOf( apk("app-release.apk") ) val selected = ApkArchitectureHelper.selectBestApk(assets) assertTrue(selected is ApkSelectionResult.Single) assertEquals("app-release.apk", (selected as ApkSelectionResult.Single).asset.name) }
Summary by CodeRabbit
Refactor
Tests