File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
feature-main/src/test/java/com/hoc/flowmvi/ui/main Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -206,4 +206,30 @@ class MainVMTest : BaseMviViewModelTest<
206
206
delayAfterDispatchingIntents = Duration .milliseconds(100 ),
207
207
) { coVerify(exactly = 0 ) { refreshGetUsersUseCase() } }
208
208
}
209
+
210
+ @Test
211
+ fun test_withRefreshIntent_ignoredWhenHavingError () {
212
+ val ioException = IOException ()
213
+ test(
214
+ vmProducer = {
215
+ every { getUserUseCase() } returns flow { throw ioException }
216
+ coEvery { refreshGetUsersUseCase() } returns Unit
217
+ vm
218
+ },
219
+ intentsBeforeCollecting = flowOf(ViewIntent .Initial ),
220
+ intents = flowOf(ViewIntent .Refresh ),
221
+ expectedStates = listOf (
222
+ ViewState (
223
+ userItems = emptyList(),
224
+ isLoading = false ,
225
+ error = ioException,
226
+ isRefreshing = false ,
227
+ )
228
+ ),
229
+ expectedEvents = listOf (
230
+ SingleEvent .GetUsersError (ioException),
231
+ ),
232
+ delayAfterDispatchingIntents = Duration .milliseconds(100 ),
233
+ ) { coVerify(exactly = 0 ) { refreshGetUsersUseCase() } }
234
+ }
209
235
}
You can’t perform that action at this time.
0 commit comments