Skip to content

Instantly share code, notes, and snippets.

@gabrielbmoro
Created January 5, 2022 03:34
Show Gist options
  • Save gabrielbmoro/d393db0e5db90f354de2ad967f056785 to your computer and use it in GitHub Desktop.
Save gabrielbmoro/d393db0e5db90f354de2ad967f056785 to your computer and use it in GitHub Desktop.
Example 1 - Unit tests article
private val localRepository = mockk<LocalRepository>()
@Test
fun `user name - already exists a user name`() {
every { localRepository.userName() }.returns("Moro")
val viewModel = UserNameStepViewModel(localRepository)
val result = viewModel.userName
Truth.assertThat(result).isEqualTo("Moro")
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment