Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-07 11:32:19 +04:00
parent b3138bf560
commit 3088258c74
14 changed files with 339 additions and 97 deletions

View file

@ -97,9 +97,9 @@ class UserTokensResponseAccountIdEnricherTest {
val validNetworkId = mockCryptoCurrencyFactory.ethereum.network.rawId
val tokenWithUnknownNetworkId = mockCryptoCurrencyFactory.ethereum.toResponseToken(
accountId = null,
networkId = unknownNetworkId,
derivationPath = "m/44'/60'/0'/0/0",
accountId = null,
)
val tokenWithValidNetworkId = mockCryptoCurrencyFactory.ethereum.toResponseToken(
@ -122,6 +122,32 @@ class UserTokensResponseAccountIdEnricherTest {
Truth.assertThat(actual).isEqualTo(expected)
}
@Test
fun `skips tokens with existing account ids`() {
// Arrange
val tokenWithAccountId = mockCryptoCurrencyFactory.ethereum
.toResponseToken(derivationPath = "m/44'/60'/0'/0/0")
.enrichWithAccountId(accountIndex = 0)
val tokenWithoutAccountId = mockCryptoCurrencyFactory.ethereum.toResponseToken(
accountId = null,
derivationPath = "m/44'/60'/0'/0/0",
)
val response = listOf(tokenWithAccountId, tokenWithoutAccountId).toResponse()
// Act
val actual = UserTokensResponseAccountIdEnricher(userWalletId, response)
// Assert
val expected = listOf(
tokenWithAccountId,
tokenWithoutAccountId.enrichWithAccountId(accountIndex = 0),
).toResponse()
Truth.assertThat(actual).isEqualTo(expected)
}
private fun CryptoCurrency.toResponseToken(
accountId: AccountId? = null,
networkId: String? = null,