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