Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class MainViewModel : ViewModel() {
private var userData: Any? = null
fun getUserData(): Any? = userData
suspend fun saveSessionData() {
viewModelScope.launch {
userData = "some_user_data"
class MainViewModelTest {
fun testsSaveSessionData() = runBlockingTest {
val mainViewModel = MainViewModel()
val userData = mainViewModel.getUserData()
assertEquals("some_user_data", userData)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment