Skip to content

Commit

Permalink
test: fix test by returning value for userViewModel.user
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrish92 committed Dec 19, 2024
1 parent 406e831 commit 1ac42a5
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.ui.test.performScrollTo
import com.android.periodpals.R
import com.android.periodpals.model.authentication.AuthenticationViewModel
import com.android.periodpals.model.user.AuthenticationUserData
import com.android.periodpals.model.user.User
import com.android.periodpals.model.user.UserViewModel
import com.android.periodpals.resources.C.Tag.BottomNavigationMenu
import com.android.periodpals.resources.C.Tag.SettingsScreen
Expand Down Expand Up @@ -41,6 +42,21 @@ class SettingsScreenTest {

companion object {
private val userData = mutableStateOf(AuthenticationUserData("uid", "email@epfl.com"))

private val name = "John Doe"
private val imageUrl = "https://example.com"
private val description = "A short description"
private val dob = "01/01/2000"
private val preferredDistance = 500
private val userState =
mutableStateOf(
User(
name = name,
imageUrl = imageUrl,
description = description,
dob = dob,
preferredDistance = preferredDistance,
))
}

@Before
Expand All @@ -50,6 +66,7 @@ class SettingsScreenTest {
userViewModel = mock(UserViewModel::class.java)

`when`(navigationActions.currentRoute()).thenReturn(Screen.SETTINGS)
`when`(userViewModel.user).thenReturn(userState)
}

@Test
Expand Down

0 comments on commit 1ac42a5

Please sign in to comment.