I'm not able to figure out how to test that a SharedFlow with replay=0 emitted a value.
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.runBlocking
import org.junit.Test
class ShowcaseTest {
@Test
fun testIntSharedFlowFlow() {
val intSharedFlow = MutableSharedFlow<Int>()
runBlocking {
intSharedFlow.emit(1)
}
// Does not work as there is no buffer because MutableSharedFlow(replay=0)
assert(intSharedFlow.replayCache.first() == 1)
}
}