Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sridhar-sp committed Jan 5, 2025
1 parent f9efaaf commit f25a352
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ class ProfileViewModel @Inject constructor(
@Test
fun `should call logout callback when logout button is pressed`() = runTest(testDispatcher) {
Dispatchers.setMain(testDispatcher)


// Arrange
val savedStateHandleMock = mockk<SavedStateHandle>()
every<String?> { savedStateHandleMock[BundleArgs.KEY_EMAIL] } returns "abcd@gmail.com"

Expand All @@ -220,14 +221,14 @@ fun `should call logout callback when logout button is pressed`() = runTest(test
isLogoutSuccess = true
}
}

val profileViewModel = ProfileViewModel(savedStateHandleMock, logoutStub)
assertThat(profileViewModel.emailAddress).isEqualTo("abcd@gmail.com")
assertThat(profileViewModel.shouldLogout).isFalse()

// Act
profileViewModel.logout()
runCurrent() // run current co routine to completion

// Assert
assertThat(profileViewModel.shouldLogout).isTrue()
assertThat(isLogoutSuccess).isTrue()
}
Expand Down

0 comments on commit f25a352

Please sign in to comment.