Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-30 16:48:26 +03:00
parent acf110dbcc
commit 6910f74fd9
242 changed files with 866 additions and 732 deletions

View file

@ -28,7 +28,7 @@ object MockYieldBalanceWrapperDTOFactory {
amount = BigDecimal.ONE,
date = null,
pricePerShare = BigDecimal.ZERO,
pendingActions = listOf(),
pendingActions = emptyList(),
pendingActionConstraints = null,
tokenDTO = TokenDTO(
name = "The-Open-Network",

View file

@ -30,13 +30,13 @@ object MockYieldDTOFactory {
logoURI = null,
isPoints = null,
),
tokens = listOf(),
tokens = emptyList(),
args = YieldDTO.ArgsDTO(
enter = YieldDTO.ArgsDTO.Enter(
addresses = YieldDTO.ArgsDTO.Enter.Addresses(
address = AddressArgumentDTO(required = false),
),
args = mapOf(),
args = emptyMap(),
),
exit = null,
),
@ -69,7 +69,7 @@ object MockYieldDTOFactory {
logoURI = null,
isPoints = null,
),
tokensDTO = listOf(),
tokensDTO = emptyList(),
type = "type",
rewardSchedule = YieldDTO.MetadataDTO.RewardScheduleDTO.DAY,
cooldownPeriod = null,
@ -81,7 +81,7 @@ object MockYieldDTOFactory {
revshare = YieldDTO.MetadataDTO.EnabledDTO(enabled = true),
fee = YieldDTO.MetadataDTO.EnabledDTO(enabled = true),
),
validators = listOf(),
validators = emptyList(),
isAvailable = true,
)
}

View file

@ -63,7 +63,7 @@ object MockScanResponseFactory {
isResettingUserCodesAllowed = false,
isLinkedTerminalEnabled = false,
isBackupAllowed = cardConfig is MultiWalletCardConfig,
supportedEncryptionModes = listOf(),
supportedEncryptionModes = emptyList(),
isFilesAllowed = true,
isHDWalletAllowed = cardConfig is MultiWalletCardConfig,
isKeysImportAllowed = true,
@ -72,7 +72,7 @@ object MockScanResponseFactory {
linkedTerminalStatus = CardDTO.LinkedTerminalStatus.Current,
isAccessCodeSet = false,
isPasscodeSet = null,
supportedCurves = listOf(),
supportedCurves = emptyList(),
wallets = cardConfig.mandatoryCurves.map {
CardDTO.Wallet(
CardWallet(
@ -85,7 +85,7 @@ object MockScanResponseFactory {
index = 0,
isImported = true,
hasBackup = true,
derivedKeys = mapOf(),
derivedKeys = emptyMap(),
),
)
},

View file

@ -21,19 +21,20 @@ object MockNetworkStatusFactory {
): NetworkStatus {
return NetworkStatus(
network = network,
value = NetworkStatus.Verified(
address = NetworkAddress.Single(
defaultAddress = NetworkAddress.Address(
value = "0x1",
type = NetworkAddress.Address.Type.Primary,
value = transform(
NetworkStatus.Verified(
address = NetworkAddress.Single(
defaultAddress = NetworkAddress.Address(
value = "0x1",
type = NetworkAddress.Address.Type.Primary,
),
),
amounts = emptyMap(),
pendingTransactions = emptyMap(),
yieldSupplyStatuses = emptyMap(),
source = source,
),
amounts = mapOf(),
pendingTransactions = mapOf(),
yieldSupplyStatuses = mapOf(),
source = source,
)
.let(transform),
),
)
}

View file

@ -37,7 +37,7 @@ object MockUserWalletFactory {
return UserWallet.Cold(
name = "NODL",
walletId = UserWalletId("011"),
cardsInWallet = setOf(),
cardsInWallet = emptySet(),
isMultiCurrency = false,
scanResponse = MockScanResponseFactory.create(
cardConfig = GenericCardConfig(maxWalletCount = 2),

View file

@ -8,11 +8,11 @@ import com.google.common.truth.Truth
fun <B> assertEither(actual: Either<Throwable, B>, expected: Either<Throwable, B>) {
actual
.onRight { Truth.assertThat(actual).isEqualTo(expected) }
.onLeft {
val expectedError = expected.leftOrNull() ?: error("Actual is Either.Left: $it")
.onLeft { throwable ->
val expectedError = expected.leftOrNull() ?: error("Actual is Either.Left: $throwable")
Truth.assertThat(it).isInstanceOf(expectedError::class.java)
Truth.assertThat(it).hasMessageThat().isEqualTo(expectedError.message)
Truth.assertThat(throwable).isInstanceOf(expectedError::class.java)
Truth.assertThat(throwable).hasMessageThat().isEqualTo(expectedError.message)
}
}
@ -24,6 +24,7 @@ fun assertEitherRight(actual: Either<Throwable, Unit>) {
}
}
@Suppress("NullableToStringCall")
fun <B> assertEitherLeft(actual: Either<Throwable, B>, expected: Throwable) {
actual
.onRight { error("Actual is Either.Right: $it") }