Last active
October 25, 2022 20:26
-
-
Save mcatta/1e6aff9110c05089d1475aecf674e917 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `Test confirm upon a failure`() = coroutineTestRule.scope.runTest { | |
// Given | |
coEvery { githubRepository.repositoryByOwner(any()) } returns Either.Left(AppError.Network) | |
// When / Then | |
stateMachine.state.test { | |
stateMachine.dispatch(GithubAction.TypeOwner("mcatta")) | |
stateMachine.dispatch(GithubAction.Confirm) | |
assertIs<GithubState.ContentState>(awaitItem()) // Initial State | |
assertIs<GithubState.ContentState>(awaitItem()) // State after typing | |
assertIs<GithubState.Load>(awaitItem()) // Confirm Action | |
assertIs<GithubState.Error>(awaitItem()) // Error upon API failure | |
coVerify { githubRepository.repositoryByOwner(eq("mcatta")) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment