Is there a testing library other than turbine, whi...
# coroutines
u
Is there a testing library other than turbine, which would work with MutableStateFlow, i.e. sideffecting type of code? (toList hangs) in rx it would looks like this
Copy code
@Test fun `doSomething should move state to FINAL`() {
    val viewModel = createViewModel(initialState = State.INITIAL)

    val testSubscriber = viewModel.state.test()
    viewModel.doSomething()

    testSubscriber.assertValues(State.INITIAL, State.FINAL)
}
g
j
Yeah and Turbine supports MutableStateFlow's just fine. Basically if it emits, Turbine captures it.
u
Thx guys, but i mentioned other than turbine. I'm just like the way rx did it better. Is there something wrong with the sample below?
e
What I like about turbine is that it allows me to easily test setup assert initial state call function under test assert state(s), event(s), error(s) (call more stuff and assert more) final assertions cleanup instead of setup calls assert all the things without knowing the order of emissions w.r.t. calls final assertions cleanup
u
@Erik as compared to what
g
comparing to rx test subject