Test hotfixes

This commit is contained in:
Milan Cerovsky 2024-08-19 13:53:09 +02:00
parent 07b2b4727b
commit 222bb4309b
4 changed files with 35 additions and 19 deletions

View File

@ -6,6 +6,8 @@ import cash.z.ecc.android.sdk.Synchronizer
import cash.z.ecc.android.sdk.block.processor.CompactBlockProcessor
import cash.z.ecc.android.sdk.model.Account
import cash.z.ecc.android.sdk.model.BlockHeight
import cash.z.ecc.android.sdk.model.FastestServersResult
import cash.z.ecc.android.sdk.model.ObserveFiatCurrencyResult
import cash.z.ecc.android.sdk.model.PercentDecimal
import cash.z.ecc.android.sdk.model.Proposal
import cash.z.ecc.android.sdk.model.TransactionOverview
@ -30,6 +32,13 @@ internal class MockSynchronizer : CloseableSynchronizer {
override val latestBirthdayHeight: BlockHeight
get() = error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
override suspend fun getFastestServers(
context: Context,
servers: List<LightWalletEndpoint>
): Flow<FastestServersResult> {
TODO("Not yet implemented")
}
override val latestHeight: BlockHeight
get() = error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
@ -64,6 +73,7 @@ internal class MockSynchronizer : CloseableSynchronizer {
override val processorInfo: Flow<CompactBlockProcessor.ProcessorInfo>
get() = error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
override val progress: Flow<PercentDecimal>
get() = TODO("Not yet implemented")
@ -72,12 +82,16 @@ internal class MockSynchronizer : CloseableSynchronizer {
override val status: Flow<Synchronizer.Status>
get() = error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
override val transactions: Flow<List<TransactionOverview>>
get() = TODO("Not yet implemented")
override val transparentBalance: StateFlow<Zatoshi?>
get() = error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
override val exchangeRateUsd: StateFlow<ObserveFiatCurrencyResult>
get() = TODO("Not yet implemented")
override fun close() {
error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
}
@ -109,6 +123,10 @@ internal class MockSynchronizer : CloseableSynchronizer {
error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
}
override suspend fun refreshExchangeRateUsd() {
TODO("Not yet implemented")
}
override suspend fun getTransparentBalance(tAddr: String): Zatoshi {
error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
}
@ -129,6 +147,10 @@ internal class MockSynchronizer : CloseableSynchronizer {
error("Intentionally not implemented in ${MockSynchronizer::class.simpleName} implementation.")
}
override suspend fun isValidTexAddr(address: String): Boolean {
TODO("Not yet implemented")
}
override suspend fun proposeShielding(
account: Account,
shieldingThreshold: Zatoshi,
@ -165,9 +187,9 @@ internal class MockSynchronizer : CloseableSynchronizer {
@Deprecated(
"Upcoming SDK 2.1 will create multiple transactions at once for some recipients.",
replaceWith =
ReplaceWith(
"createProposedTransactions(proposeTransfer(usk.account, toAddress, amount, memo), usk)"
)
ReplaceWith(
"createProposedTransactions(proposeTransfer(usk.account, toAddress, amount, memo), usk)"
)
)
override suspend fun sendToAddress(
usk: UnifiedSpendingKey,
@ -181,9 +203,9 @@ internal class MockSynchronizer : CloseableSynchronizer {
@Deprecated(
"Upcoming SDK 2.1 will create multiple transactions at once for some recipients.",
replaceWith =
ReplaceWith(
"proposeShielding(usk.account, shieldingThreshold, memo)?.let { createProposedTransactions(it, usk) }"
)
ReplaceWith(
"proposeShielding(usk.account, shieldingThreshold, memo)?.let { createProposedTransactions(it, usk) }"
)
)
override suspend fun shieldFunds(
usk: UnifiedSpendingKey,

View File

@ -9,6 +9,7 @@ import androidx.compose.ui.unit.dp
import androidx.test.filters.MediumTest
import co.electriccoin.zcash.test.UiTestPrerequisites
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
import co.electriccoin.zcash.ui.screen.account.AccountTag
import co.electriccoin.zcash.ui.screen.account.AccountTestSetup
@ -40,7 +41,9 @@ class AccountViewIntegrationTest : UiTestPrerequisites() {
val testSetup = newTestSetup(walletSnapshot)
restorationTester.setContent {
testSetup.DefaultContent(isHideBalances = false)
ZcashTheme {
testSetup.DefaultContent(isHideBalances = false)
}
}
assertEquals(WalletSnapshotFixture.SAPLING_BALANCE, testSetup.getWalletSnapshot().saplingBalance)

View File

@ -12,6 +12,7 @@ import cash.z.ecc.android.sdk.model.Zatoshi
import cash.z.ecc.android.sdk.model.ZecSend
import cash.z.ecc.android.sdk.type.AddressType
import co.electriccoin.zcash.ui.common.model.TopAppBarSubTitleState
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
@ -130,7 +131,7 @@ class SendViewTestSetup(
value = "",
fiatValue = "",
isTransparentRecipient = false,
exchangeRateState = null
exchangeRateState = ExchangeRateState.OptedOut
),
setMemoState = {},
memoState = MemoState.new(""),
@ -142,6 +143,7 @@ class SendViewTestSetup(
available = Zatoshi(Zatoshi.MAX_INCLUSIVE.div(100))
)
),
exchangeRateState = ExchangeRateState.OptedOut
)
}
}

View File

@ -10,8 +10,6 @@ import cash.z.ecc.android.sdk.model.MonetarySeparators
import cash.z.ecc.android.sdk.model.Zatoshi
import cash.z.ecc.android.sdk.model.ZcashNetwork
import cash.z.ecc.sdk.fixture.ZecSendFixture
import co.electriccoin.zcash.ui.common.model.TopAppBarSubTitleState
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
import co.electriccoin.zcash.ui.fixture.MockSynchronizer
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
import co.electriccoin.zcash.ui.screen.send.WrapSend
@ -65,21 +63,12 @@ class SendViewIntegrationTest {
restorationTester.setContent {
WrapSend(
balanceState = BalanceStateFixture.new(),
sendArguments = null,
synchronizer = synchronizer,
walletSnapshot = walletSnapshot,
spendingKey = spendingKey,
goToQrScanner = {},
goBack = {},
goBalances = {},
goSettings = {},
goSendConfirmation = {},
isHideBalances = false,
onHideBalances = {},
hasCameraFeature = true,
monetarySeparators = monetarySeparators,
topAppBarSubTitleState = TopAppBarSubTitleState.None,
)
}