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
|
||||
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -12,7 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource
|
|||
internal class LogsSanitizerTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun sanitize(model: TestModel) {
|
||||
// Act
|
||||
val actual = LogsSanitizer.sanitize(model.input)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package com.tangem.data.networks.converters
|
|||
import com.google.common.truth.Truth
|
||||
import com.tangem.datasource.local.network.entity.NetworkStatusDM
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -18,7 +18,7 @@ class NetworkDerivationPathConverterTest {
|
|||
inner class Convert {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun convert(model: ConvertModel) {
|
||||
// Act
|
||||
val actual = NetworkDerivationPathConverter.convert(value = model.value)
|
||||
|
|
@ -57,7 +57,7 @@ class NetworkDerivationPathConverterTest {
|
|||
inner class ConvertBack {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun convertBack(model: ConvertBackModel) {
|
||||
// Act
|
||||
val actual = NetworkDerivationPathConverter.convertBack(value = model.value)
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ dependencies {
|
|||
implementation(deps.kotlin.coroutines)
|
||||
implementation(deps.kotlin.serialization)
|
||||
|
||||
testImplementation(deps.test.coroutine)
|
||||
testImplementation(deps.test.junit5)
|
||||
testImplementation(projects.test.core)
|
||||
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.CryptoPortfolioIcon
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -81,7 +81,7 @@ class AccountListTest {
|
|||
inner class Create {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun invoke(model: CreateTestModel) {
|
||||
// Act
|
||||
val actual = AccountList(
|
||||
|
|
@ -158,7 +158,7 @@ class AccountListTest {
|
|||
inner class Plus {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun invoke(model: PlusTestModel) {
|
||||
// Act
|
||||
val actual = model.initial.plus(other = model.toAdd)
|
||||
|
|
@ -231,7 +231,7 @@ class AccountListTest {
|
|||
inner class Minus {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun invoke(model: MinusTestModel) {
|
||||
// Act
|
||||
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.lceLoading
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.test.core.getEmittedValues
|
||||
import io.mockk.*
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
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 org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
|
@ -85,15 +81,4 @@ class GetArchivedAccountsUseCaseTest {
|
|||
coVerifyOrder { crudRepository.fetchArchivedAccounts(userWalletId) }
|
||||
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)
|
||||
implementation(deps.arrow.core)
|
||||
|
||||
testImplementation(deps.test.junit5)
|
||||
testImplementation(projects.test.core)
|
||||
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.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
class AccountIdTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun forCryptoPortfolio(model: ForCryptoPortfolioModel) {
|
||||
// Arrange
|
||||
val userWalletId = UserWalletId("27163F47405CE73110837F24DF82607FF11C7AF9D78C93F409E4FEAFF3400C8F")
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package com.tangem.domain.models.account
|
|||
import arrow.core.Either
|
||||
import arrow.core.left
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -14,7 +14,7 @@ import org.junit.jupiter.params.provider.MethodSource
|
|||
class AccountNameTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun invoke(model: InvokeTestModel) {
|
||||
// Act
|
||||
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.Icon
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import io.mockk.every
|
||||
import io.mockk.mockkObject
|
||||
import io.mockk.unmockkObject
|
||||
|
|
@ -11,7 +12,6 @@ import io.mockk.verifyOrder
|
|||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +25,7 @@ class CryptoPortfolioIconTest {
|
|||
inner class OfMainAccount {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun ofMainAccount(model: OfMainAccountModel) {
|
||||
// Act
|
||||
val actual = CryptoPortfolioIcon.ofMainAccount(userWalletId = model.userWalletId)
|
||||
|
|
@ -84,7 +84,7 @@ class CryptoPortfolioIconTest {
|
|||
inner class OfDefaultCustomAccount {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun ofCustomAccount(model: OfDefaultCustomAccountModel) {
|
||||
// Arrange
|
||||
val availableIcons = Icon.entries - setOf(Icon.Letter, Icon.Star)
|
||||
|
|
@ -139,7 +139,7 @@ class CryptoPortfolioIconTest {
|
|||
inner class OfCustomAccountWithTypeAndColor {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun ofCustomAccount(model: OfCustomAccountModel) {
|
||||
// Act
|
||||
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.right
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.test.core.ProvideTestModels
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.MethodSource
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -27,7 +27,7 @@ class DerivationIndexTest {
|
|||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestModels")
|
||||
@ProvideTestModels
|
||||
fun invoke(model: InvokeTestModel) {
|
||||
// Act
|
||||
val actual = DerivationIndex(model.index)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue