Skip to content

Commit df5daf8

Browse files
committed
addtests
1 parent 4aae8f7 commit df5daf8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

feature-main/src/test/java/com/hoc/flowmvi/ui/main/MainVMTest.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import kotlinx.coroutines.flow.flow
1616
import kotlinx.coroutines.flow.flowOf
1717
import java.io.IOException
1818
import kotlin.test.Test
19+
import kotlin.time.Duration
1920
import kotlin.time.ExperimentalTime
2021

2122
private val USERS = listOf(
@@ -191,4 +192,18 @@ class MainVMTest : BaseMviViewModelTest<
191192
),
192193
) { coVerify(exactly = 1) { refreshGetUsersUseCase() } }
193194
}
195+
196+
@Test
197+
fun test_withRefreshIntent_ignoredWhenIsLoading() {
198+
test(
199+
vmProducer = {
200+
coEvery { refreshGetUsersUseCase() } returns Unit
201+
vm
202+
},
203+
intents = flowOf(ViewIntent.Refresh),
204+
expectedStates = listOf(ViewState.initial()),
205+
expectedEvents = emptyList(),
206+
delayAfterDispatchingIntents = Duration.milliseconds(100),
207+
) { coVerify(exactly = 0) { refreshGetUsersUseCase() } }
208+
}
194209
}

0 commit comments

Comments
 (0)