Updated on 2026-08-14
This commit is contained in:
parent
f9ae6c2519
commit
96154e6983
11 changed files with 262 additions and 165 deletions
1
test/mock/.gitignore
vendored
Normal file
1
test/mock/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
8
test/mock/build.gradle.kts
Normal file
8
test/mock/build.gradle.kts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
plugins {
|
||||
alias(deps.plugins.kotlin.jvm)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.domain.account)
|
||||
}
|
||||
60
test/mock/src/main/java/com/tangem/test/mock/MockAccounts.kt
Normal file
60
test/mock/src/main/java/com/tangem/test/mock/MockAccounts.kt
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
package com.tangem.test.mock
|
||||
|
||||
import com.tangem.domain.account.models.AccountList
|
||||
import com.tangem.domain.models.account.*
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
object MockAccounts {
|
||||
|
||||
val userWalletId = UserWalletId("011")
|
||||
|
||||
val onlyMainAccount = createAccountList(activeAccounts = 1)
|
||||
|
||||
val fullAccountList = createAccountList(activeAccounts = 20)
|
||||
|
||||
fun createAccountList(
|
||||
activeAccounts: Int,
|
||||
totalAccounts: Int = activeAccounts,
|
||||
userWalletId: UserWalletId = this.userWalletId,
|
||||
): AccountList {
|
||||
return AccountList(
|
||||
userWalletId = userWalletId,
|
||||
accounts = createAccounts(count = activeAccounts, userWalletId = userWalletId),
|
||||
totalAccounts = totalAccounts,
|
||||
).getOrNull()!!
|
||||
}
|
||||
|
||||
fun createAccounts(count: Int, userWalletId: UserWalletId = this.userWalletId): List<Account.CryptoPortfolio> {
|
||||
return buildList {
|
||||
add(Account.CryptoPortfolio.createMainAccount(userWalletId))
|
||||
|
||||
repeat(count - 1) {
|
||||
val account = createAccount(derivationIndex = it + 1, userWalletId = userWalletId)
|
||||
|
||||
add(account)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun createAccount(
|
||||
derivationIndex: Int,
|
||||
name: String = "Account #$derivationIndex",
|
||||
icon: CryptoPortfolioIcon = CryptoPortfolioIcon.ofDefaultCustomAccount(),
|
||||
cryptoCurrencies: Set<CryptoCurrency> = emptySet(),
|
||||
userWalletId: UserWalletId = this.userWalletId,
|
||||
): Account.CryptoPortfolio {
|
||||
val derivationIndex = DerivationIndex(derivationIndex).getOrNull()!!
|
||||
|
||||
return Account.CryptoPortfolio(
|
||||
accountId = AccountId.forCryptoPortfolio(userWalletId = userWalletId, derivationIndex = derivationIndex),
|
||||
accountName = AccountName(name).getOrNull()!!,
|
||||
icon = icon,
|
||||
derivationIndex = derivationIndex,
|
||||
cryptoCurrencies = cryptoCurrencies,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue