From 8cf586f27b1925b5bda54a322434f0b13fd86f8c Mon Sep 17 00:00:00 2001 From: Honza Date: Tue, 20 Aug 2024 18:29:26 +0200 Subject: [PATCH] Fix test fixtures --- .../ui/fixture/ExchangeRateStateFixture.kt | 4 +++- .../ObserveFiatCurrencyResultFixture.kt | 20 +++++++++++-------- .../zcash/ui/util/PreviewScreens.kt | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ExchangeRateStateFixture.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ExchangeRateStateFixture.kt index 0cff119f..4cd0cf65 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ExchangeRateStateFixture.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ExchangeRateStateFixture.kt @@ -3,5 +3,7 @@ package co.electriccoin.zcash.ui.fixture import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState object ExchangeRateStateFixture { - fun new() = ExchangeRateState.OptedOut + val STATE = ExchangeRateState.OptedOut + + fun new(state: ExchangeRateState = STATE) = state } diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ObserveFiatCurrencyResultFixture.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ObserveFiatCurrencyResultFixture.kt index 9c46d900..9ac9a2cd 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ObserveFiatCurrencyResultFixture.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/fixture/ObserveFiatCurrencyResultFixture.kt @@ -5,14 +5,18 @@ import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState import kotlinx.datetime.Clock object ObserveFiatCurrencyResultFixture { + const val IS_LOADING: Boolean = true + const val IS_STALE: Boolean = false + const val IS_REFRESH_ENABLED: Boolean = false + val CURRENCY_CONVERSION: FiatCurrencyConversion = FiatCurrencyConversion( + timestamp = Clock.System.now(), + priceOfZec = 25.0 + ) + fun new( - isLoading: Boolean = true, - isStale: Boolean = false, - isRefreshEnabled: Boolean = true, - currencyConversion: FiatCurrencyConversion? = - FiatCurrencyConversion( - timestamp = Clock.System.now(), - priceOfZec = 25.0 - ), + isLoading: Boolean = IS_LOADING, + isStale: Boolean = IS_STALE, + isRefreshEnabled: Boolean = IS_REFRESH_ENABLED, + currencyConversion: FiatCurrencyConversion? = CURRENCY_CONVERSION, ) = ExchangeRateState.Data(isLoading, isStale, isRefreshEnabled, currencyConversion) {} } diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/PreviewScreens.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/PreviewScreens.kt index 7ff26009..a3935d9a 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/PreviewScreens.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/PreviewScreens.kt @@ -3,6 +3,7 @@ package co.electriccoin.zcash.ui.util import android.content.res.Configuration import androidx.compose.ui.tooling.preview.Preview +@Suppress("UnusedPrivateMember") @Preview(name = "1: Light preview", showBackground = true) @Preview(name = "2: Dark preview", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES) annotation class PreviewScreens