Rename methods around verification, to match SDK naming.

This commit is contained in:
Benoit Marty 2026-05-05 12:17:51 +02:00
parent c40f916b4f
commit 51bcaca9db
5 changed files with 39 additions and 39 deletions

View file

@ -46,7 +46,7 @@ class OutgoingVerificationStateMachine(
inState<State.RequestingVerification> {
onEnterEffect { event ->
when (event.verificationRequest) {
is VerificationRequest.Outgoing.CurrentSession -> sessionVerificationService.requestCurrentSessionVerification()
is VerificationRequest.Outgoing.CurrentSession -> sessionVerificationService.requestDeviceVerification()
is VerificationRequest.Outgoing.User -> sessionVerificationService.requestUserVerification(event.verificationRequest.userId)
}
}
@ -56,7 +56,7 @@ class OutgoingVerificationStateMachine(
}
inState<State.StartingSasVerification> {
onEnterEffect {
sessionVerificationService.startVerification()
sessionVerificationService.startSasVerification()
}
}
inState<State.VerificationRequestAccepted> {

View file

@ -50,11 +50,11 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - Handles requestVerification for session verification`() = runTest {
val requestSessionVerificationRecorder = lambdaRecorder<Unit> {}
val startVerificationRecorder = lambdaRecorder<Unit> {}
val requestDeviceVerificationRecorder = lambdaRecorder<Unit> {}
val startSasVerificationRecorder = lambdaRecorder<Unit> {}
val service = unverifiedSessionService(
requestSessionVerificationLambda = requestSessionVerificationRecorder,
startVerificationLambda = startVerificationRecorder,
requestDeviceVerificationLambda = requestDeviceVerificationRecorder,
startSasVerificationLambda = startSasVerificationRecorder,
)
val presenter = createOutgoingVerificationPresenter(
service = service,
@ -63,18 +63,18 @@ class OutgoingVerificationPresenterTest {
presenter.test {
requestVerificationAndAwaitVerifyingState(service)
requestSessionVerificationRecorder.assertions().isCalledOnce()
startVerificationRecorder.assertions().isCalledOnce()
requestDeviceVerificationRecorder.assertions().isCalledOnce()
startSasVerificationRecorder.assertions().isCalledOnce()
}
}
@Test
fun `present - Handles requestVerification for user verification`() = runTest {
val requestUserVerificationRecorder = lambdaRecorder<UserId, Unit> {}
val startVerificationRecorder = lambdaRecorder<Unit> {}
val startSasVerificationRecorder = lambdaRecorder<Unit> {}
val service = unverifiedSessionService(
requestUserVerificationLambda = requestUserVerificationRecorder,
startVerificationLambda = startVerificationRecorder,
startSasVerificationLambda = startSasVerificationRecorder,
)
val presenter = createOutgoingVerificationPresenter(
service = service,
@ -84,7 +84,7 @@ class OutgoingVerificationPresenterTest {
requestVerificationAndAwaitVerifyingState(service)
requestUserVerificationRecorder.assertions().isCalledOnce()
startVerificationRecorder.assertions().isCalledOnce()
startSasVerificationRecorder.assertions().isCalledOnce()
}
}
@ -106,8 +106,8 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - A failure when verifying cancels it`() = runTest {
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
startVerificationLambda = { },
requestDeviceVerificationLambda = { },
startSasVerificationLambda = { },
approveVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
@ -125,7 +125,7 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - A fail when requesting verification resets the state to the canceled one`() = runTest {
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
requestDeviceVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
presenter.test {
@ -139,8 +139,8 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - Canceling the flow once it's verifying cancels it`() = runTest {
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
startVerificationLambda = { },
requestDeviceVerificationLambda = { },
startSasVerificationLambda = { },
cancelVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
@ -154,8 +154,8 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - When verifying, if we receive another challenge we ignore it`() = runTest {
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
startVerificationLambda = { },
requestDeviceVerificationLambda = { },
startSasVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
presenter.test {
@ -168,8 +168,8 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - Go back after cancellation returns to initial state`() = runTest {
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
startVerificationLambda = { },
requestDeviceVerificationLambda = { },
startSasVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
presenter.test {
@ -189,8 +189,8 @@ class OutgoingVerificationPresenterTest {
VerificationEmoji(number = 30)
)
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
startVerificationLambda = { },
requestDeviceVerificationLambda = { },
startSasVerificationLambda = { },
approveVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
@ -215,8 +215,8 @@ class OutgoingVerificationPresenterTest {
@Test
fun `present - When verification is declined, the flow is canceled`() = runTest {
val service = unverifiedSessionService(
requestSessionVerificationLambda = { },
startVerificationLambda = { },
requestDeviceVerificationLambda = { },
startSasVerificationLambda = { },
declineVerificationLambda = { },
)
val presenter = createOutgoingVerificationPresenter(service)
@ -298,23 +298,23 @@ class OutgoingVerificationPresenterTest {
}
private suspend fun unverifiedSessionService(
requestSessionVerificationLambda: () -> Unit = { lambdaError() },
requestDeviceVerificationLambda: () -> Unit = { lambdaError() },
requestUserVerificationLambda: (UserId) -> Unit = { lambdaError() },
cancelVerificationLambda: () -> Unit = { lambdaError() },
approveVerificationLambda: () -> Unit = { lambdaError() },
declineVerificationLambda: () -> Unit = { lambdaError() },
startVerificationLambda: () -> Unit = { lambdaError() },
startSasVerificationLambda: () -> Unit = { lambdaError() },
resetLambda: (Boolean) -> Unit = { },
acknowledgeVerificationRequestLambda: (VerificationRequest.Incoming) -> Unit = { lambdaError() },
acceptVerificationRequestLambda: () -> Unit = { lambdaError() },
): FakeSessionVerificationService {
return FakeSessionVerificationService(
requestCurrentSessionVerificationLambda = requestSessionVerificationLambda,
requestDeviceVerificationLambda = requestDeviceVerificationLambda,
requestUserVerificationLambda = requestUserVerificationLambda,
cancelVerificationLambda = cancelVerificationLambda,
approveVerificationLambda = approveVerificationLambda,
declineVerificationLambda = declineVerificationLambda,
startVerificationLambda = startVerificationLambda,
startSasVerificationLambda = startSasVerificationLambda,
resetLambda = resetLambda,
acknowledgeVerificationRequestLambda = acknowledgeVerificationRequestLambda,
acceptVerificationRequestLambda = acceptVerificationRequestLambda,