Created
August 7, 2022 13:30
-
-
Save motorro/af0f0c874d6f1cb03fc234a53ecc5de3 to your computer and use it in GitHub Desktop.
Mocking state dependencies
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
class CredentialsCheckStateTest { | |
private val data = LoginDataState() | |
private val factory: LoginStateFactory = mockk() | |
private val passwordEntry: LoginState = mockk() | |
@Test | |
fun returnsToPasswordEntryOnBack() = runTest { | |
every { factory.passwordEntry(any()) } returns passwordEntry | |
state.start(stateMachine) | |
state.process(LoginGesture.Back) | |
verify { stateMachine.setMachineState(passwordEntry) } | |
verify { factory.passwordEntry(data) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment