appstore: also fail the catalogue sync in TvCheckBranchesTest
- Commit
0e98913361e18b4760ac76406ccc7a83ac16a5c5- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-14 23:13 UTC (21 days ago)
- Parents
a6ce185
Follow-up to the ViewModel-injection fix: the TV check syncs the catalogue before asking Play, and with live network that sync imports the real catalogue, so the installed test package is in the index, Play is never asked, and detailsOrNull of an empty candidate list counts as an answered (empty) lookup that clears the previous Play rows. Fail the F-Droid downloads as the other offline tests do, so the sync fails closed and Play is asked and cannot answer. Assertions unchanged. Verified: targeted :appstore:testDevUnitTest run (see final full-suite run).
Diff
appstore/src/test/java/com/vayunmathur/appstore/tv/TvCheckBranchesTest.kt
diff --git a/appstore/src/test/java/com/vayunmathur/appstore/tv/TvCheckBranchesTest.kt b/appstore/src/test/java/com/vayunmathur/appstore/tv/TvCheckBranchesTest.ktindex 29d2b2bab8..4371969649 100644--- a/appstore/src/test/java/com/vayunmathur/appstore/tv/TvCheckBranchesTest.kt+++ b/appstore/src/test/java/com/vayunmathur/appstore/tv/TvCheckBranchesTest.kt@@ -9,6 +9,7 @@ import com.vayunmathur.appstore.data.AccrescentTrustEntity import com.vayunmathur.appstore.data.AppDatabase import com.vayunmathur.appstore.data.AppSource import com.vayunmathur.appstore.data.UnifiedApp+import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertTrue@@ -33,6 +34,12 @@ class TvCheckBranchesTest { @BeforeTest fun setUp() {+ // Hermetic offline: the check's catalogue sync must fail too, or+ // a live sync imports the real catalogue and Play is never asked+ // (its previous rows are then cleared as 'answered empty').+ com.vayunmathur.appstore.data.FDroidRepository.downloadOverride = { url, _ ->+ throw java.io.IOException("offline test double for $url")+ } val app = ApplicationProvider.getApplicationContext<Application>() ownPackage = app.packageName db = Room.inMemoryDatabaseBuilder(app, AppDatabase::class.java)@@ -79,6 +86,11 @@ class TvCheckBranchesTest { ) } + @AfterTest+ fun tearDown() {+ com.vayunmathur.appstore.data.FDroidRepository.downloadOverride = null+ }+ private fun await(description: String, condition: () -> Boolean) { val deadline = System.currentTimeMillis() + 30_000 while (System.currentTimeMillis() < deadline) {