Updated on 2026-08-14
This commit is contained in:
parent
024a37517d
commit
dce2f5cf90
10 changed files with 22 additions and 42 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
package com.tangem.datasource.local.logs
|
package com.tangem.datasource.local.logs
|
||||||
|
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[REDACTED_AUTHOR]
|
[REDACTED_AUTHOR]
|
||||||
|
|
@ -12,7 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource
|
||||||
internal class LogsSanitizerTest {
|
internal class LogsSanitizerTest {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun sanitize(model: TestModel) {
|
fun sanitize(model: TestModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = LogsSanitizer.sanitize(model.input)
|
val actual = LogsSanitizer.sanitize(model.input)
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ package com.tangem.data.networks.converters
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
import com.tangem.datasource.local.network.entity.NetworkStatusDM
|
import com.tangem.datasource.local.network.entity.NetworkStatusDM
|
||||||
import com.tangem.domain.models.network.Network
|
import com.tangem.domain.models.network.Network
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import org.junit.jupiter.api.Nested
|
import org.junit.jupiter.api.Nested
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[REDACTED_AUTHOR]
|
[REDACTED_AUTHOR]
|
||||||
|
|
@ -18,7 +18,7 @@ class NetworkDerivationPathConverterTest {
|
||||||
inner class Convert {
|
inner class Convert {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun convert(model: ConvertModel) {
|
fun convert(model: ConvertModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = NetworkDerivationPathConverter.convert(value = model.value)
|
val actual = NetworkDerivationPathConverter.convert(value = model.value)
|
||||||
|
|
@ -57,7 +57,7 @@ class NetworkDerivationPathConverterTest {
|
||||||
inner class ConvertBack {
|
inner class ConvertBack {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun convertBack(model: ConvertBackModel) {
|
fun convertBack(model: ConvertBackModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = NetworkDerivationPathConverter.convertBack(value = model.value)
|
val actual = NetworkDerivationPathConverter.convertBack(value = model.value)
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@ dependencies {
|
||||||
implementation(deps.kotlin.coroutines)
|
implementation(deps.kotlin.coroutines)
|
||||||
implementation(deps.kotlin.serialization)
|
implementation(deps.kotlin.serialization)
|
||||||
|
|
||||||
testImplementation(deps.test.coroutine)
|
testImplementation(projects.test.core)
|
||||||
testImplementation(deps.test.junit5)
|
|
||||||
testRuntimeOnly(deps.test.junit5.engine)
|
testRuntimeOnly(deps.test.junit5.engine)
|
||||||
testImplementation(deps.test.mockk)
|
|
||||||
testImplementation(deps.test.truth)
|
|
||||||
}
|
}
|
||||||
|
|
@ -9,11 +9,11 @@ import com.tangem.domain.models.account.Account
|
||||||
import com.tangem.domain.models.account.AccountName
|
import com.tangem.domain.models.account.AccountName
|
||||||
import com.tangem.domain.models.account.CryptoPortfolioIcon
|
import com.tangem.domain.models.account.CryptoPortfolioIcon
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import org.junit.jupiter.api.Nested
|
import org.junit.jupiter.api.Nested
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[REDACTED_AUTHOR]
|
[REDACTED_AUTHOR]
|
||||||
|
|
@ -81,7 +81,7 @@ class AccountListTest {
|
||||||
inner class Create {
|
inner class Create {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun invoke(model: CreateTestModel) {
|
fun invoke(model: CreateTestModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = AccountList(
|
val actual = AccountList(
|
||||||
|
|
@ -158,7 +158,7 @@ class AccountListTest {
|
||||||
inner class Plus {
|
inner class Plus {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun invoke(model: PlusTestModel) {
|
fun invoke(model: PlusTestModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = model.initial.plus(other = model.toAdd)
|
val actual = model.initial.plus(other = model.toAdd)
|
||||||
|
|
@ -231,7 +231,7 @@ class AccountListTest {
|
||||||
inner class Minus {
|
inner class Minus {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun invoke(model: MinusTestModel) {
|
fun invoke(model: MinusTestModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = model.initial.minus(model.toRemove)
|
val actual = model.initial.minus(model.toRemove)
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,10 @@ import com.tangem.domain.core.utils.lceContent
|
||||||
import com.tangem.domain.core.utils.lceError
|
import com.tangem.domain.core.utils.lceError
|
||||||
import com.tangem.domain.core.utils.lceLoading
|
import com.tangem.domain.core.utils.lceLoading
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
|
import com.tangem.test.core.getEmittedValues
|
||||||
import io.mockk.*
|
import io.mockk.*
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
import kotlinx.coroutines.flow.flowOf
|
import kotlinx.coroutines.flow.flowOf
|
||||||
import kotlinx.coroutines.flow.toList
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.test.TestScope
|
|
||||||
import kotlinx.coroutines.test.UnconfinedTestDispatcher
|
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
@ -85,15 +81,4 @@ class GetArchivedAccountsUseCaseTest {
|
||||||
coVerifyOrder { crudRepository.fetchArchivedAccounts(userWalletId) }
|
coVerifyOrder { crudRepository.fetchArchivedAccounts(userWalletId) }
|
||||||
coVerify(inverse = true) { crudRepository.getArchivedAccounts(any()) }
|
coVerify(inverse = true) { crudRepository.getArchivedAccounts(any()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
|
||||||
fun <T> TestScope.getEmittedValues(flow: Flow<T>): List<T> {
|
|
||||||
val values = mutableListOf<T>()
|
|
||||||
|
|
||||||
backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) {
|
|
||||||
flow.toList(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
return values
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -23,8 +23,6 @@ dependencies {
|
||||||
ksp(deps.moshi.kotlin.codegen)
|
ksp(deps.moshi.kotlin.codegen)
|
||||||
implementation(deps.arrow.core)
|
implementation(deps.arrow.core)
|
||||||
|
|
||||||
testImplementation(deps.test.junit5)
|
testImplementation(projects.test.core)
|
||||||
testRuntimeOnly(deps.test.junit5.engine)
|
testRuntimeOnly(deps.test.junit5.engine)
|
||||||
testImplementation(deps.test.truth)
|
|
||||||
testImplementation(deps.test.mockk)
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,15 +2,15 @@ package com.tangem.domain.models.account
|
||||||
|
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
class AccountIdTest {
|
class AccountIdTest {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun forCryptoPortfolio(model: ForCryptoPortfolioModel) {
|
fun forCryptoPortfolio(model: ForCryptoPortfolioModel) {
|
||||||
// Arrange
|
// Arrange
|
||||||
val userWalletId = UserWalletId("27163F47405CE73110837F24DF82607FF11C7AF9D78C93F409E4FEAFF3400C8F")
|
val userWalletId = UserWalletId("27163F47405CE73110837F24DF82607FF11C7AF9D78C93F409E4FEAFF3400C8F")
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ package com.tangem.domain.models.account
|
||||||
import arrow.core.Either
|
import arrow.core.Either
|
||||||
import arrow.core.left
|
import arrow.core.left
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[REDACTED_AUTHOR]
|
[REDACTED_AUTHOR]
|
||||||
|
|
@ -14,7 +14,7 @@ import org.junit.jupiter.params.provider.MethodSource
|
||||||
class AccountNameTest {
|
class AccountNameTest {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun invoke(model: InvokeTestModel) {
|
fun invoke(model: InvokeTestModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = AccountName(value = model.value)
|
val actual = AccountName(value = model.value)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.google.common.truth.Truth
|
||||||
import com.tangem.domain.models.account.CryptoPortfolioIcon.Color
|
import com.tangem.domain.models.account.CryptoPortfolioIcon.Color
|
||||||
import com.tangem.domain.models.account.CryptoPortfolioIcon.Icon
|
import com.tangem.domain.models.account.CryptoPortfolioIcon.Icon
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.mockkObject
|
import io.mockk.mockkObject
|
||||||
import io.mockk.unmockkObject
|
import io.mockk.unmockkObject
|
||||||
|
|
@ -11,7 +12,6 @@ import io.mockk.verifyOrder
|
||||||
import org.junit.jupiter.api.Nested
|
import org.junit.jupiter.api.Nested
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,7 +25,7 @@ class CryptoPortfolioIconTest {
|
||||||
inner class OfMainAccount {
|
inner class OfMainAccount {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun ofMainAccount(model: OfMainAccountModel) {
|
fun ofMainAccount(model: OfMainAccountModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = CryptoPortfolioIcon.ofMainAccount(userWalletId = model.userWalletId)
|
val actual = CryptoPortfolioIcon.ofMainAccount(userWalletId = model.userWalletId)
|
||||||
|
|
@ -84,7 +84,7 @@ class CryptoPortfolioIconTest {
|
||||||
inner class OfDefaultCustomAccount {
|
inner class OfDefaultCustomAccount {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun ofCustomAccount(model: OfDefaultCustomAccountModel) {
|
fun ofCustomAccount(model: OfDefaultCustomAccountModel) {
|
||||||
// Arrange
|
// Arrange
|
||||||
val availableIcons = Icon.entries - setOf(Icon.Letter, Icon.Star)
|
val availableIcons = Icon.entries - setOf(Icon.Letter, Icon.Star)
|
||||||
|
|
@ -139,7 +139,7 @@ class CryptoPortfolioIconTest {
|
||||||
inner class OfCustomAccountWithTypeAndColor {
|
inner class OfCustomAccountWithTypeAndColor {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun ofCustomAccount(model: OfCustomAccountModel) {
|
fun ofCustomAccount(model: OfCustomAccountModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = CryptoPortfolioIcon.ofCustomAccount(value = model.icon, color = model.color)
|
val actual = CryptoPortfolioIcon.ofCustomAccount(value = model.icon, color = model.color)
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ import arrow.core.Either
|
||||||
import arrow.core.left
|
import arrow.core.left
|
||||||
import arrow.core.right
|
import arrow.core.right
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
|
import com.tangem.test.core.ProvideTestModels
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.TestInstance
|
import org.junit.jupiter.api.TestInstance
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[REDACTED_AUTHOR]
|
[REDACTED_AUTHOR]
|
||||||
|
|
@ -27,7 +27,7 @@ class DerivationIndexTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideTestModels")
|
@ProvideTestModels
|
||||||
fun invoke(model: InvokeTestModel) {
|
fun invoke(model: InvokeTestModel) {
|
||||||
// Act
|
// Act
|
||||||
val actual = DerivationIndex(model.index)
|
val actual = DerivationIndex(model.index)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue