Updated on 2026-08-14
This commit is contained in:
parent
8aa61944ba
commit
6480fb498d
2 changed files with 21 additions and 2 deletions
|
|
@ -619,10 +619,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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue