Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-24 16:37:44 +04:00
commit 67577e8653
6 changed files with 93 additions and 15 deletions

View file

@ -621,10 +621,11 @@ internal class StakingModel @Inject constructor(
}
override fun onAmountEnterClick() {
if (integration.preferredTargets.isEmpty()) {
val actionType = uiState.value.actionType
if (actionType !is StakingActionCommonType.Exit && integration.preferredTargets.isEmpty()) {
messageSender.send(StakingAlertUM.noAvailableValidators())
} else {
if (uiState.value.actionType is StakingActionCommonType.Enter) {
if (actionType is StakingActionCommonType.Enter) {
stateController.updateAll(
ValidatorSelectChangeTransformer(
selectedTarget = null,

View file

@ -354,6 +354,24 @@ internal class StakingModelNavigationTest : StakingModelTestBase() {
model.onDestroy()
}
@Test
fun `GIVEN empty preferredTargets AND Exit action WHEN onAmountEnterClick THEN no alert sent`() = runTest {
every { stateController.value } returns initialUiState
every { initialUiState.actionType } returns StakingActionCommonType.Exit(partiallyUnstakeDisabled = false)
every { testYield.preferredValidators } returns emptyList()
every { messageSender.send(any()) } just Runs
val model = createModel(testScope = this)
advanceUntilIdle()
model.onAmountEnterClick()
advanceUntilIdle()
verify(exactly = 0) { messageSender.send(any()) }
model.onDestroy()
}
@Test
fun `GIVEN non-empty preferredTargets WHEN onAmountEnterClick THEN validator reset and onNextClick called`() =
runTest {