1. Testing the most recent or latest emitted item :
- In our tests, in most of the cases, we are only interested in the last emitted value.For instance, for any
UI state
we are mostly interested on what will be the finalUI state
. And to test the last emitted value, we can do the following
@Test
fun verifyErrorOnUpcomingShiftsFetchUIState() = runDeputyTest {
// given fetched result is failure
coEvery { getGroupedUpcomingShifts(request) } returns Failure()
// when