Update in-app update checking

This commit is contained in:
Koitharu
2022-07-21 19:32:32 +03:00
parent c158c4e18e
commit 089e3dc209
19 changed files with 232 additions and 105 deletions

View File

@@ -9,10 +9,10 @@ import org.junit.Test
import org.koitharu.kotatsu.BuildConfig
import org.koitharu.kotatsu.parsers.util.await
class GithubRepositoryTest {
class AppUpdateRepositoryTest {
private val okHttpClient = OkHttpClient()
private val repository = GithubRepository(okHttpClient)
private val repository = AppUpdateRepository(okHttpClient)
@Test
fun getLatestVersion() = runTest {
@@ -23,11 +23,11 @@ class GithubRepositoryTest {
Request.Builder()
.url(version.apkUrl)
.head()
.build()
.build(),
).await()
Assert.assertTrue(versionId <= VersionId(BuildConfig.VERSION_NAME))
Assert.assertTrue(apkHead.isSuccessful)
Assert.assertEquals(version.apkSize, apkHead.headersContentLength())
}
}
}