Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-03 19:57:47 +04:00
parent 3cc0a643e9
commit 642190f7c6
98 changed files with 317 additions and 202 deletions

View file

@ -28,11 +28,17 @@ dependencies {
implementation(deps.arrow.core)
implementation(deps.test.junit)
implementation(deps.test.truth)
testImplementation(projects.test.core)
testImplementation(deps.test.junit5)
testRuntimeOnly(deps.test.junit5.engine)
testImplementation(deps.test.truth)
// region DI
implementation(deps.hilt.android)
kapt(deps.hilt.kapt)
// end
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}

View file

@ -33,8 +33,13 @@ dependencies {
implementation(deps.androidx.core.ktx)
/* Tests */
testImplementation(deps.test.junit)
testImplementation(deps.test.junit5)
testRuntimeOnly(deps.test.junit5.engine)
testImplementation(deps.test.coroutine)
testImplementation(deps.test.truth)
testImplementation(deps.test.mockk)
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}

View file

@ -1,14 +1,14 @@
package com.tangem.common.routing.deeplink
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
internal class DeepLinkBuilderTest {
private lateinit var deepLinkBuilder: DeepLinkBuilder
@Before
@BeforeEach
fun setup() {
deepLinkBuilder = DeepLinkBuilder()
}

View file

@ -10,7 +10,7 @@ import com.tangem.common.routing.deeplink.DeeplinkConst.TRANSACTION_ID_KEY
import com.tangem.common.routing.deeplink.DeeplinkConst.TYPE_KEY
import com.tangem.common.routing.deeplink.DeeplinkConst.WALLET_ID_KEY
import com.tangem.domain.visa.model.TangemPayPushNotificationType
import org.junit.Test
import org.junit.jupiter.api.Test
internal class PayloadToDeeplinkConverterTest {

View file

@ -1,18 +1,17 @@
package com.tangem.common.uri
import com.google.common.truth.Truth
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import com.tangem.test.core.ProvideTestModels
import org.junit.jupiter.params.ParameterizedTest
/**
[REDACTED_AUTHOR]
*/
@RunWith(Parameterized::class)
class ExternalUrlValidatorTest(private val model: Model) {
class ExternalUrlValidatorTest {
@Test
fun test() {
@ParameterizedTest
@ProvideTestModels
fun test(model: Model) {
val actual = ExternalUrlValidator.isUriTrusted(externalUri = model.url)
Truth.assertThat(actual).isEqualTo(model.expected)
@ -21,8 +20,7 @@ class ExternalUrlValidatorTest(private val model: Model) {
companion object {
@JvmStatic
@Parameterized.Parameters
fun data(): Collection<Model> = listOf(
fun provideTestModels(): Collection<Model> = listOf(
// Trusted hosts — exact match
Model(url = "https://tangem.com", expected = true),
Model(url = "https://tangem.com/pricing/?promocode=tgapp20ups", expected = true),

View file

@ -108,14 +108,18 @@ class MockCryptoCurrencyFactory(private val userWallet: UserWallet.Cold = defaul
)
}
fun createToken(blockchain: Blockchain): CryptoCurrency.Token {
fun createToken(
blockchain: Blockchain,
id: String = "NEVER-MIND",
contractAddress: String = "NEVER-MIND",
): CryptoCurrency.Token {
return factory.createToken(
sdkToken = Token(
name = "NEVER-MIND",
symbol = "NEVER-MIND",
contractAddress = "NEVER-MIND",
contractAddress = contractAddress,
decimals = 8,
id = "NEVER-MIND",
id = id,
),
blockchain = blockchain,
extraDerivationPath = null,