Updated on 2026-08-14

This commit is contained in:
Tangem 2025-06-05 16:27:35 +04:00
parent 880668b575
commit 60c861b9e7
2 changed files with 6 additions and 4 deletions

View file

@ -15,7 +15,7 @@ import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
internal typealias WalletIdWithWrappers = Map<String, Set<YieldBalanceWrapperDTO>>
@ -55,7 +55,7 @@ internal class DefaultYieldsBalancesStore(
}
override fun get(userWalletId: UserWalletId): Flow<Set<YieldBalance>> {
return runtimeStore.get().mapNotNull { it[userWalletId] }
return runtimeStore.get().map { it[userWalletId].orEmpty() }
}
override suspend fun getSyncOrNull(userWalletId: UserWalletId, stakingId: StakingID): YieldBalance? {

View file

@ -32,7 +32,8 @@ internal class YieldsBalancesStoreGetMethodTest {
val values = getEmittedValues(flow = actual)
Truth.assertThat(values).isEqualTo(emptyList<Set<YieldBalance>>())
val expected = listOf(emptySet<YieldBalance>())
Truth.assertThat(values).isEqualTo(expected)
}
@Test
@ -43,7 +44,8 @@ internal class YieldsBalancesStoreGetMethodTest {
val values = getEmittedValues(flow = actual)
Truth.assertThat(values).isEqualTo(emptyList<Set<YieldBalance>>())
val expected = listOf(emptySet<YieldBalance>())
Truth.assertThat(values).isEqualTo(expected)
}
@Test