In Kotlin Multiplatform for Mobile, how we can write unit test to check intermediate values of
KLiveData
, can anyone give an example ?
z
Zac Sweers
01/02/2023, 3:16 AM
this is very vague and stackoverflow-y. You’re going to have better luck by being more detailed and describing what you’ve already done, rather than asking people to do the work for you
Sorry for being too short on my query. I am referring to KLiveData. Also I am relatively new in Kotlin and Kotlin Multiplatform for Mobile (KMM). I am able to write unit test in KMM for ViewModels which has LiveData and able to test various scenarios. What I am looking for is to test intermediate values for LiveData. For ex: when an api call is sent then we have an intermediate state as Loading in LiveData so I am not sure how to write unit test to check these intermediate values. I see that the LiveData has
observeForever
and
observe
methods but not able to figure out how to use them to check intermediate values.