I am used to use awaitValue + assertHistorySize to test how much a LiveData has received and what it has got. So I write the following code (only as an example):
val dataObserver = viewModel.data().test()
viewModel.setCurrentButtonFilter(DataType.AllData)
dataObserver.awaitValue(200, TimeUnit.MILLISECONDS).assertHistorySize(2)
With viewModel.data() I will get the LiveData. Everything is okay.
And now with Jetpack Compose I just start to use MutableState instead of MutableLiveData and State instead of LiveData. But I still wanna use something like assertHistorySize to test how many time the State has changed. Is there something cool to do this?
Thank you.
I am trying:
stateObserver..assertHistorySize(2)
But you know it doesn't exist :)