Skip to content

Commit

Permalink
Fix androidTest tests not compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
robinlinden committed Dec 28, 2021
1 parent 00508dd commit 5934fe8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion atox/src/androidTest/kotlin/IntegrationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import javax.inject.Singleton
import ltd.evilcorp.atox.di.AndroidModule
import ltd.evilcorp.atox.di.AppComponent
import ltd.evilcorp.atox.di.AppModule
import ltd.evilcorp.atox.di.DaoModule
import ltd.evilcorp.atox.di.ViewModelModule
import ltd.evilcorp.core.db.Database
import ltd.evilcorp.core.di.DaoModule
import ltd.evilcorp.domain.tox.PublicKey
import ltd.evilcorp.domain.tox.SaveManager
import org.hamcrest.core.AllOf.allOf
Expand Down
5 changes: 5 additions & 0 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,10 @@ dependencies {
testImplementation(Test.junit)
androidTestImplementation(AndroidX.Test.runner)
androidTestImplementation(AndroidX.Test.Ext.junit)
androidTestImplementation(Google.Guava.workaround)
androidTestImplementation(KotlinX.Coroutines.test) {
// Conflicts with a lot of things due to having embedded "byte buddy" instead of depending on it.A
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-debug")
}
androidTestImplementation(Test.mockk)
}
8 changes: 8 additions & 0 deletions domain/src/androidTest/kotlin/tox/ToxTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ package ltd.evilcorp.domain.tox
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.mockk.mockk
import java.lang.Thread.sleep
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class ToxTest {
@ExperimentalCoroutinesApi
@Test
fun quitting_does_not_crash() {
val dispatcher = TestCoroutineDispatcher()
val scope = TestCoroutineScope(dispatcher)

repeat(10) {
val tox = Tox(
scope,
mockk(relaxUnitFun = true),
mockk(relaxUnitFun = true),
mockk(relaxUnitFun = true),
Expand Down

0 comments on commit 5934fe8

Please sign in to comment.