Skip to content

Commit

Permalink
tests: fix MainViewModelTest
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Oct 3, 2024
1 parent f127447 commit 016fe50
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.*
import org.bitcoinj.core.Coin
import org.bitcoinj.core.PeerGroup
import org.bitcoinj.core.Transaction
import org.bitcoinj.params.TestNet3Params
import org.bitcoinj.utils.MonetaryFormat
Expand Down Expand Up @@ -155,6 +156,7 @@ class MainViewModelTest {
every { configMock.registerOnSharedPreferenceChangeListener(any()) } just runs

every { blockchainStateMock.observeState() } returns flow { BlockchainState() }
every { blockchainStateMock.observeSyncStage() } returns MutableStateFlow(PeerGroup.SyncStage.BLOCKS)
every { exchangeRatesMock.observeExchangeRate(any()) } returns flow { ExchangeRate("USD", "100") }
every { walletDataMock.observeBalance() } returns flow { Coin.COIN }
every { walletDataMock.observeMostRecentTransaction() } returns flow {
Expand All @@ -175,8 +177,7 @@ class MainViewModelTest {
0
)
}
every { exchangeRatesMock.observeStaleRates(any())} returns flow { RateRetrievalState(false, false, false) }
every { }
every { exchangeRatesMock.observeStaleRates(any()) } returns flow { RateRetrievalState(false, false, false) }
mockkStatic(WalletApplication::class)
every { WalletApplication.getInstance() } returns walletApp

Expand All @@ -202,6 +203,7 @@ class MainViewModelTest {
@Test
fun observeBlockchainState_replaying_notSynced() {
every { blockchainStateMock.observeState() } returns MutableStateFlow(BlockchainState(replaying = true))

val viewModel = spyk(
MainViewModel(
analyticsService, configMock, uiConfigMock,
Expand Down

0 comments on commit 016fe50

Please sign in to comment.