Updated on 2026-08-14
This commit is contained in:
parent
ac907dd7b1
commit
ff2077bb9c
2 changed files with 30 additions and 1 deletions
|
|
@ -84,7 +84,7 @@ class GetAccountCurrencyByAddressUseCase(
|
|||
params = MultiNetworkStatusProducer.Params(userWalletId = id),
|
||||
timeMillis = 1000L,
|
||||
)
|
||||
?.firstOrNull { it.getAddress() == address }
|
||||
?.firstOrNull { it.getAddress().equals(address, ignoreCase = true) }
|
||||
|
||||
if (networkStatus != null) {
|
||||
pair = id to networkStatus.network.id
|
||||
|
|
|
|||
|
|
@ -280,6 +280,35 @@ class GetAccountCurrencyByAddressUseCaseTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `returns Some when query address case differs from stored network address`() = runTest {
|
||||
// Arrange
|
||||
val currency = MockCryptoCurrencyFactory().ethereum
|
||||
val networkStatus = NetworkStatus(
|
||||
network = currency.network,
|
||||
// Stored address is lower-case
|
||||
value = NetworkStatus.Unreachable(address = validNetworkAddress),
|
||||
)
|
||||
val accountList = AccountList.empty(userWalletId = userWalletId, cryptoCurrencies = listOf(currency))
|
||||
|
||||
every { userWalletsListRepository.userWallets.value } returns listOf(multiUserWallet)
|
||||
coEvery {
|
||||
multiNetworkStatusSupplier.getSyncOrNull(params = MultiNetworkStatusProducer.Params(userWalletId), 1000)
|
||||
} returns setOf(networkStatus)
|
||||
coEvery {
|
||||
singleAccountListSupplier.getSyncOrNull(
|
||||
params = SingleAccountListProducer.Params(userWalletId = userWalletId),
|
||||
)
|
||||
} returns accountList
|
||||
|
||||
// Act — query with an EIP-55 checksummed (mixed/upper-case) variant of the same address
|
||||
val actual = useCase(validAddress.uppercase())
|
||||
|
||||
// Assert
|
||||
val expected = AccountCryptoCurrency(account = accountList.mainAccount, cryptoCurrency = currency)
|
||||
assertSome(actual, expected)
|
||||
}
|
||||
|
||||
private companion object Companion {
|
||||
const val validAddress = "0x1234567890abcdef"
|
||||
val validNetworkAddress = NetworkAddress.Single(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue