mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
fix: an unproven update-channel guess no longer moves stable users to Nightly for good
Any release-signed build not running the catalog's current stable commit was saved as NIGHTLY, so an older stable APK, a release-day install or a stale cached catalog put stable users on pre-release updates. The guess is now saved only when the catalog proves it (PR build, the catalog stable, or a version older than it); otherwise it applies to this run and is guessed again with a newer catalog.
This commit is contained in:
1 parent
3a09e5698b
commit
ac8957ae56
2 files changed
+56
-10
No files matched your search
@@ -8,6 +8,7 @@ import com.droiddeck.launcher.update.AppUpdates.Offer
|
||||
import com.droiddeck.launcher.update.AppUpdates.PreviewChange
|
||||
import com.droiddeck.launcher.update.AppUpdates.PreviewHistoryKind
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
import org.json.JSONArray
|
||||
@@ -285,4 +286,38 @@ class AppUpdatesTest {
|
||||
} catch (_: IOException) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun anOlderStableIsGuessedStableAndSaved() {
|
||||
val g = AppUpdates.guessFollow(catalog, me("eeeeeee999", version = "0.1.9"))
|
||||
assertEquals(AppUpdates.Channel.STABLE, g.follow.channel)
|
||||
assertTrue(g.certain)
|
||||
}
|
||||
|
||||
@Test fun runningTheCatalogStableIsCertainStable() {
|
||||
val g = AppUpdates.guessFollow(catalog, me(stable.commit))
|
||||
assertEquals(AppUpdates.Channel.STABLE, g.follow.channel)
|
||||
assertTrue(g.certain)
|
||||
}
|
||||
|
||||
@Test fun aPublishedPreviewPastStableIsNightlyButNotSaved() {
|
||||
val withHistory = AppUpdates.Catalog(stable, release("1111111"), emptyList(), 0L, recentPreview)
|
||||
val g = AppUpdates.guessFollow(withHistory, me("2".repeat(40), version = "0.3.0"))
|
||||
assertEquals(AppUpdates.Channel.NIGHTLY, g.follow.channel)
|
||||
assertFalse(g.certain)
|
||||
}
|
||||
|
||||
@Test fun anUncataloguedNewerBuildStaysStableForNow() {
|
||||
val g = AppUpdates.guessFollow(catalog, me("9".repeat(40), version = "0.3.0"))
|
||||
assertEquals(AppUpdates.Channel.STABLE, g.follow.channel)
|
||||
assertFalse(g.certain)
|
||||
val offline = AppUpdates.guessFollow(null, me("9".repeat(40), version = "0.3.0"))
|
||||
assertEquals(AppUpdates.Channel.STABLE, offline.follow.channel)
|
||||
assertFalse(offline.certain)
|
||||
}
|
||||
|
||||
@Test fun aPullRequestBuildIsCertainTest() {
|
||||
val g = AppUpdates.guessFollow(catalog, me("ccccccc2222222222222222222222222222222", pr = 93))
|
||||
assertEquals(AppUpdates.Channel.TEST, g.follow.channel)
|
||||
assertTrue(g.certain)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user