Skip to content

Commit

Permalink
Fix MigratorTest warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran committed Jun 17, 2024
1 parent e16d10e commit a753aa1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/test/java/mihon/core/migration/MigratorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.mockk.slot
import io.mockk.spyk
import io.mockk.verify
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.newSingleThreadContext
Expand Down Expand Up @@ -43,6 +44,7 @@ class MigratorTest {

execute.await()

@Suppress("DeferredResultUnused")
verify { migrationJobFactory.create(capture(migrations)) }
assertEquals(1, migrations.captured.size)
verify { migrationCompletedListener() }
Expand All @@ -58,6 +60,7 @@ class MigratorTest {
val result = execute.await()
assertFalse(result)

@Suppress("DeferredResultUnused")
verify(exactly = 0) { migrationJobFactory.create(any()) }
}

Expand All @@ -71,6 +74,7 @@ class MigratorTest {
val result = execute.await()
assertFalse(result)

@Suppress("DeferredResultUnused")
verify(exactly = 0) { migrationJobFactory.create(any()) }
}

Expand All @@ -84,6 +88,7 @@ class MigratorTest {

execute.await()

@Suppress("DeferredResultUnused")
verify { migrationJobFactory.create(capture(migrations)) }
assertEquals(2, migrations.captured.size)
verify { migrationCompletedListener() }
Expand Down Expand Up @@ -112,6 +117,7 @@ class MigratorTest {

execute.await()

@Suppress("DeferredResultUnused")
verify { migrationJobFactory.create(capture(migrations)) }
assertEquals(10, migrations.captured.size)
verify { migrationCompletedListener() }
Expand All @@ -133,13 +139,15 @@ class MigratorTest {

execute.await()

@Suppress("DeferredResultUnused")
verify { migrationJobFactory.create(capture(migrations)) }
assertEquals(2, migrations.captured.size)
verify { migrationCompletedListener() }
}

companion object {

@OptIn(DelicateCoroutinesApi::class)
val mainThreadSurrogate = newSingleThreadContext("UI thread")

@BeforeAll
Expand Down

0 comments on commit a753aa1

Please sign in to comment.