Updated on 2026-08-14
This commit is contained in:
parent
b3138bf560
commit
3088258c74
14 changed files with 339 additions and 97 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue