Skip to content

Commit

Permalink
fix: resolve merging problems
Browse files Browse the repository at this point in the history
Some changes from main had been incorrectly merged.
  • Loading branch information
charliemangano committed Oct 31, 2024
1 parent b4ebe26 commit 35de269
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import com.android.periodpals.model.auth.AuthViewModel
import com.android.periodpals.model.authentication.AuthenticationViewModel
import com.android.periodpals.model.user.UserAuthState
import com.android.periodpals.ui.navigation.NavigationActions
import com.android.periodpals.ui.navigation.Screen
Expand All @@ -25,7 +25,7 @@ class SignInScreenTest {

@get:Rule val composeTestRule = createComposeRule()
private lateinit var navigationActions: NavigationActions
private lateinit var authViewModel: AuthViewModel
private lateinit var authViewModel: AuthenticationViewModel

companion object {
private const val email = "test@example.com"
Expand All @@ -35,11 +35,11 @@ class SignInScreenTest {
@Before
fun setUp() {
navigationActions = mock(NavigationActions::class.java)
authViewModel = mock(AuthViewModel::class.java)
authViewModel = mock(AuthenticationViewModel::class.java)

`when`(navigationActions.currentRoute()).thenReturn(Screen.SIGN_IN)
`when`(authViewModel.userAuthState)
.thenReturn(mutableStateOf(UserAuthState.Success("User is logged in")))
.thenReturn(mutableStateOf(UserAuthState.Success("User is logged in")))
composeTestRule.setContent { SignInScreen(authViewModel, navigationActions) }
}

Expand Down Expand Up @@ -73,7 +73,7 @@ class SignInScreenTest {

composeTestRule.onNodeWithTag("signInPassword").performTextInput(password)
composeTestRule.onNodeWithTag("signInButton").performClick()
verify(authViewModel, never()).logInWithEmail(any(), any(), any())
verify(authViewModel, never()).logInWithEmail(any(), any())
}

@Test
Expand All @@ -83,16 +83,16 @@ class SignInScreenTest {
composeTestRule.onNodeWithTag("signInButton").performClick()
composeTestRule.onNodeWithTag("signInPasswordError").assertIsDisplayed()
composeTestRule
.onNodeWithTag("signInPasswordError")
.assertTextEquals("Password cannot be empty")
.onNodeWithTag("signInPasswordError")
.assertTextEquals("Password cannot be empty")
}

@Test
fun emptyPasswordDoesNotCallVM() {

composeTestRule.onNodeWithTag("signInEmail").performTextInput(email)
composeTestRule.onNodeWithTag("signInButton").performClick()
verify(authViewModel, never()).logInWithEmail(any(), any(), any())
verify(authViewModel, never()).logInWithEmail(any(), any())
}

@Test
Expand All @@ -109,7 +109,7 @@ class SignInScreenTest {
composeTestRule.onNodeWithTag("signInEmail").performTextInput(email)
composeTestRule.onNodeWithTag("signInPassword").performTextInput(password)
composeTestRule.onNodeWithTag("signInButton").performClick()
verify(authViewModel).logInWithEmail(any(), eq(email), eq(password))
verify(authViewModel).logInWithEmail(eq(email), eq(password))
}

@Test
Expand Down

0 comments on commit 35de269

Please sign in to comment.