mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 02:36:24 -04:00
Fixed unit coverage test cases.
* Upgraded the jacoco dependency to `0.8.12`. * Fixed StartSpeechInputTest was failing.
This commit is contained in:
parent
23fa4500df
commit
0b4bc66858
@ -13,7 +13,7 @@ repositories {
|
||||
dependencies {
|
||||
implementation("com.android.tools.build:gradle:8.1.3")
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
|
||||
implementation("org.jacoco:org.jacoco.core:0.8.8")
|
||||
implementation("org.jacoco:org.jacoco.core:0.8.12")
|
||||
implementation("org.jlleitschuh.gradle:ktlint-gradle:10.3.0")
|
||||
implementation("com.google.apis:google-api-services-androidpublisher:v3-rev20230406-2.0.0") {
|
||||
exclude(group = "com.google.guava", module = "guava")
|
||||
|
@ -64,7 +64,7 @@ class AllProjectConfigurer {
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
isTestCoverageEnabled = true
|
||||
isTestCoverageEnabled = false
|
||||
multiDexEnabled = true
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@ class AllProjectConfigurer {
|
||||
resolutionStrategy {
|
||||
eachDependency {
|
||||
if ("org.jacoco" == this.requested.group) {
|
||||
useVersion("0.8.8")
|
||||
useVersion("0.8.12")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package org.kiwix.kiwixmobile.core.search.viewmodel.effects
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.speech.RecognizerIntent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkConstructor
|
||||
@ -29,6 +28,7 @@ import io.mockk.verify
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
|
||||
import org.kiwix.kiwixmobile.core.search.viewmodel.Action
|
||||
import org.kiwix.kiwixmobile.core.search.viewmodel.Action.StartSpeechInputFailed
|
||||
import java.util.Locale
|
||||
@ -40,7 +40,7 @@ internal class StartSpeechInputTest {
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
fun `when invoke with throws exception offer StartSpeechInputFailed action`() {
|
||||
val activity = mockk<AppCompatActivity>(relaxed = true)
|
||||
val activity = mockk<CoreMainActivity>(relaxed = true)
|
||||
every { activity.startActivityForResult(any(), any()) } throws ActivityNotFoundException()
|
||||
StartSpeechInput(actions).invokeWith(activity)
|
||||
verify { actions.trySend(StartSpeechInputFailed).isSuccess }
|
||||
@ -49,8 +49,8 @@ internal class StartSpeechInputTest {
|
||||
@Suppress("DEPRECATION")
|
||||
@Test
|
||||
fun `invoke with starts an activity for speech recognition`() {
|
||||
val activity = mockk<AppCompatActivity>()
|
||||
every { activity.getString(R.string.app_name) } returns "app"
|
||||
val activity = mockk<CoreMainActivity>()
|
||||
every { activity.appName } returns "app"
|
||||
every { activity.getString(R.string.speech_prompt_text, "app") } returns "the app"
|
||||
every { activity.startActivityForResult(any(), any()) } returns Unit
|
||||
mockkConstructor(Intent::class)
|
||||
|
@ -19,7 +19,7 @@
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.8"
|
||||
toolVersion = "0.8.12"
|
||||
}
|
||||
|
||||
tasks.withType(Test) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
<issue id="InvalidPackage">
|
||||
<ignore path="**simple-xml-2.7.1.jar" />
|
||||
<ignore path="**javapoet-1.8.0.jar" />
|
||||
<ignore path="**/org.jacoco.agent-0.8.8-runtime.jar" />
|
||||
<ignore path="**/org.jacoco.agent-0.8.10-runtime.jar" />
|
||||
<ignore regexp="kotlinx.coroutines.debug.AgentPremain" />
|
||||
</issue>
|
||||
<issue id="IconLocation">
|
||||
|
Loading…
x
Reference in New Issue
Block a user