Updated on 2026-08-14
This commit is contained in:
parent
20484baaf1
commit
bee4019e8b
49 changed files with 1256 additions and 72 deletions
|
|
@ -9,6 +9,7 @@ data class AddressEntry(
|
|||
val id: AddressEntryId,
|
||||
val address: String,
|
||||
val networkId: Network.RawID,
|
||||
val networkName: String,
|
||||
val memo: String?,
|
||||
val signature: String,
|
||||
)
|
||||
|
|
@ -259,6 +259,7 @@ internal class AddressBookCipherTest {
|
|||
networkId = Network.RawID("ethereum"),
|
||||
memo = memo,
|
||||
signature = "",
|
||||
networkName = "Ethereum",
|
||||
)
|
||||
|
||||
private fun String.flipFirstHexNibble(): String = (if (first() == '0') '1' else '0') + substring(1)
|
||||
|
|
|
|||
|
|
@ -5,23 +5,14 @@ import arrow.core.right
|
|||
import com.google.common.truth.Truth.assertThat
|
||||
import com.tangem.domain.addressbook.error.ContactNameValidationError
|
||||
import com.tangem.domain.addressbook.error.SaveContactError
|
||||
import com.tangem.domain.addressbook.model.AddressEntry
|
||||
import com.tangem.domain.addressbook.model.AddressEntryId
|
||||
import com.tangem.domain.addressbook.model.Contact
|
||||
import com.tangem.domain.addressbook.model.ContactId
|
||||
import com.tangem.domain.addressbook.model.ContactName
|
||||
import com.tangem.domain.addressbook.model.*
|
||||
import com.tangem.domain.addressbook.repository.AddressBookRepository
|
||||
import com.tangem.domain.addressbook.time.IsoTimestampProvider
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.transaction.error.SignHashesError
|
||||
import io.mockk.clearMocks
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.coVerify
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.slot
|
||||
import io.mockk.*
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
|
|
@ -57,6 +48,7 @@ class CreateContactUseCaseTest {
|
|||
networkId = networkRawId,
|
||||
memo = "memo",
|
||||
signature = "sig",
|
||||
networkName = "Ethereum",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -165,6 +157,7 @@ class CreateContactUseCaseTest {
|
|||
networkId = networkRawId,
|
||||
memo = null,
|
||||
signature = "sig",
|
||||
networkName = "Ethereum",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ class GetContactsUseCaseTest {
|
|||
networkId = Network.RawID("ethereum"),
|
||||
memo = null,
|
||||
signature = "sig",
|
||||
networkName = "Ethereum",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,7 @@ package com.tangem.domain.addressbook.usecase
|
|||
import arrow.core.left
|
||||
import arrow.core.right
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import com.tangem.domain.addressbook.model.AddressEntriesVerification
|
||||
import com.tangem.domain.addressbook.model.AddressEntry
|
||||
import com.tangem.domain.addressbook.model.AddressEntryId
|
||||
import com.tangem.domain.addressbook.model.Contact
|
||||
import com.tangem.domain.addressbook.model.ContactId
|
||||
import com.tangem.domain.addressbook.model.ContactName
|
||||
import com.tangem.domain.addressbook.model.VerifiedContact
|
||||
import com.tangem.domain.addressbook.model.*
|
||||
import com.tangem.domain.common.wallets.UserWalletsListRepository
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
|
|
@ -103,6 +97,7 @@ class GetVerifiedContactsUseCaseTest {
|
|||
networkId = Network.RawID("ethereum"),
|
||||
memo = null,
|
||||
signature = "sig-$id",
|
||||
networkName = "Ethereum",
|
||||
)
|
||||
|
||||
private fun contact(name: String, entries: List<AddressEntry>): Contact = Contact(
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ class SignAddressEntriesUseCaseTest {
|
|||
networkId = Network.RawID("ethereum"),
|
||||
memo = memo,
|
||||
signature = "",
|
||||
networkName = "Ethereum",
|
||||
)
|
||||
|
||||
private fun expectedHash(contact: Contact, entry: AddressEntry): ByteArray {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class UpdateContactUseCaseTest {
|
|||
networkId = networkRawId,
|
||||
memo = "memo",
|
||||
signature = "sig2",
|
||||
networkName = "Ethereum",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -137,6 +138,7 @@ class UpdateContactUseCaseTest {
|
|||
networkId = networkRawId,
|
||||
memo = null,
|
||||
signature = "sig",
|
||||
networkName = "Ethereum",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class ValidateContactNameUseCaseTest {
|
|||
networkId = Network.RawID("ethereum"),
|
||||
memo = null,
|
||||
signature = "sig",
|
||||
networkName = "Ethereum",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ class VerifyAddressEntriesUseCaseTest {
|
|||
networkId = Network.RawID("ethereum"),
|
||||
memo = memo,
|
||||
signature = signature,
|
||||
networkName = "Ethereum",
|
||||
)
|
||||
|
||||
private fun expectedPayload(contact: Contact, entry: AddressEntry): String =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue