Dodaj aktualizacje aplikacji kierowcy przez Google Play
This commit is contained in:
@@ -115,6 +115,75 @@ class DriverUiRulesTest {
|
||||
assertTrue(navigationIntentCandidates(null, null, "Cel").isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun showsAnOptionalUpdateWhenGooglePlayOrBackendHasANewerVersion() {
|
||||
val fromPlay = appUpdateBannerUi(
|
||||
currentVersionCode = 113,
|
||||
latestVersionCode = null,
|
||||
latestVersionName = null,
|
||||
minimumSupportedVersionCode = 0,
|
||||
playUpdateAvailable = true,
|
||||
playAvailableVersionCode = 114,
|
||||
updateDownloaded = false,
|
||||
)
|
||||
val fromBackend = appUpdateBannerUi(
|
||||
currentVersionCode = 113,
|
||||
latestVersionCode = 114,
|
||||
latestVersionName = "1.0.61",
|
||||
minimumSupportedVersionCode = 0,
|
||||
playUpdateAvailable = false,
|
||||
playAvailableVersionCode = null,
|
||||
updateDownloaded = false,
|
||||
)
|
||||
|
||||
assertEquals(false, fromPlay?.required)
|
||||
assertEquals("Aktualizuj", fromPlay?.actionLabel)
|
||||
assertEquals("Dostępna jest nowa wersja aplikacji 1.0.61.", fromBackend?.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun requiresAnUpdateOnlyBelowTheConfiguredMinimumVersion() {
|
||||
val required = appUpdateBannerUi(
|
||||
currentVersionCode = 111,
|
||||
latestVersionCode = 114,
|
||||
latestVersionName = "1.0.61",
|
||||
minimumSupportedVersionCode = 112,
|
||||
playUpdateAvailable = true,
|
||||
playAvailableVersionCode = 114,
|
||||
updateDownloaded = false,
|
||||
)
|
||||
val current = appUpdateBannerUi(
|
||||
currentVersionCode = 114,
|
||||
latestVersionCode = 114,
|
||||
latestVersionName = "1.0.61",
|
||||
minimumSupportedVersionCode = 112,
|
||||
playUpdateAvailable = false,
|
||||
playAvailableVersionCode = null,
|
||||
updateDownloaded = false,
|
||||
)
|
||||
|
||||
assertEquals(true, required?.required)
|
||||
assertTrue(required?.message?.contains("nie jest już obsługiwana") == true)
|
||||
assertEquals(null, current)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun downloadedUpdateUsesInstallAction() {
|
||||
val update = appUpdateBannerUi(
|
||||
currentVersionCode = 113,
|
||||
latestVersionCode = 114,
|
||||
latestVersionName = "1.0.61",
|
||||
minimumSupportedVersionCode = 0,
|
||||
playUpdateAvailable = true,
|
||||
playAvailableVersionCode = 114,
|
||||
updateDownloaded = true,
|
||||
)
|
||||
|
||||
assertEquals("Zainstaluj", update?.actionLabel)
|
||||
assertEquals(true, update?.downloaded)
|
||||
assertTrue(update?.message?.contains("gotowa do instalacji") == true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun calculatesPhotoGridRowsForTwoColumnInlineGallery() {
|
||||
assertEquals(0, inlinePhotoGridRows(0))
|
||||
|
||||
Reference in New Issue
Block a user