`fun <T> Flow<T>.test(scope: Coroutine...
# coroutines
u
Copy code
fun <T> Flow<T>.test(scope: CoroutineScope): TestCollector<T> {
    return TestCollector(scope, this)
}
Copy code
class TestCollector<T>(
    scope: CoroutineScope,
    flow: Flow<T>
) {
    private val values = mutableListOf<T>()
Copy code
init {
       scope.launch {
           flow.collect {
               values += it
           }
       }
    }
Copy code
fun assertValues(vararg values: T) {
        assertEquals(values.toList(), this.values)
    }
}
quick and dirty of how it worked in rx -- see anything wrong with it?
🧵 3