mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-29 15:50:46 +00:00
Simplify VM
This commit is contained in:
parent
885df1e22b
commit
a7111b0d49
@ -297,9 +297,9 @@ dependencies {
|
|||||||
implementation "com.opencsv:opencsv:4.6"
|
implementation "com.opencsv:opencsv:4.6"
|
||||||
testImplementation "junit:junit:$junitVersion"
|
testImplementation "junit:junit:$junitVersion"
|
||||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||||
testImplementation "org.mockito:mockito-inline:4.10.0"
|
testImplementation "org.mockito:mockito-inline:4.11.0"
|
||||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||||
androidTestImplementation "org.mockito:mockito-android:4.10.0"
|
androidTestImplementation "org.mockito:mockito-android:4.11.0"
|
||||||
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||||
testImplementation "androidx.test:core:$testCoreVersion"
|
testImplementation "androidx.test:core:$testCoreVersion"
|
||||||
testImplementation "androidx.arch.core:core-testing:2.2.0"
|
testImplementation "androidx.arch.core:core-testing:2.2.0"
|
||||||
|
@ -86,7 +86,7 @@ fun OptionsCard(card: CardModel, callbacks: Callbacks) {
|
|||||||
) {
|
) {
|
||||||
itemsIndexed(card.options) { i, it ->
|
itemsIndexed(card.options) { i, it ->
|
||||||
if (i != 0) Divider()
|
if (i != 0) Divider()
|
||||||
TitledRadioButton(it) { it.onClick(callbacks) }
|
TitledRadioButton(it) { callbacks.setMode(it.value) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,15 +111,15 @@ class ExpirationSettingsViewModel(
|
|||||||
expirationConfig = storage.getExpirationConfiguration(threadId)
|
expirationConfig = storage.getExpirationConfiguration(threadId)
|
||||||
val expiryMode = expirationConfig?.expiryMode ?: ExpiryMode.NONE
|
val expiryMode = expirationConfig?.expiryMode ?: ExpiryMode.NONE
|
||||||
val recipient = threadDb.getRecipientForThreadId(threadId)
|
val recipient = threadDb.getRecipientForThreadId(threadId)
|
||||||
val groupInfo = recipient?.takeIf { it.isClosedGroupRecipient }
|
val groupRecord = recipient?.takeIf { it.isClosedGroupRecipient }
|
||||||
?.run { address.toGroupString().let(groupDb::getGroup).orNull() }
|
?.run { address.toGroupString().let(groupDb::getGroup).orNull() }
|
||||||
|
|
||||||
_state.update { state ->
|
_state.update { state ->
|
||||||
state.copy(
|
state.copy(
|
||||||
address = recipient?.address,
|
address = recipient?.address,
|
||||||
isGroup = groupInfo != null,
|
isGroup = groupRecord != null,
|
||||||
isNoteToSelf = recipient?.address?.serialize() == textSecurePreferences.getLocalNumber(),
|
isNoteToSelf = recipient?.address?.serialize() == textSecurePreferences.getLocalNumber(),
|
||||||
isSelfAdmin = groupInfo == null || groupInfo.admins.any{ it.serialize() == textSecurePreferences.getLocalNumber() },
|
isSelfAdmin = groupRecord == null || groupRecord.admins.any{ it.serialize() == textSecurePreferences.getLocalNumber() },
|
||||||
expiryMode = expiryMode,
|
expiryMode = expiryMode,
|
||||||
persistedMode = expiryMode
|
persistedMode = expiryMode
|
||||||
)
|
)
|
||||||
@ -222,21 +222,21 @@ private fun typeOptions(state: State) =
|
|||||||
state.takeUnless { it.modeOptionsHidden }?.run {
|
state.takeUnless { it.modeOptionsHidden }?.run {
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
typeOption(
|
typeOption(
|
||||||
ExpiryType.NONE,
|
ExpiryMode.NONE,
|
||||||
state,
|
state,
|
||||||
R.string.expiration_off,
|
R.string.expiration_off,
|
||||||
contentDescription = R.string.AccessibilityId_disable_disappearing_messages,
|
contentDescription = R.string.AccessibilityId_disable_disappearing_messages,
|
||||||
enabled = isSelfAdmin
|
enabled = isSelfAdmin
|
||||||
),
|
),
|
||||||
if (!isNewConfigEnabled) typeOption(
|
if (!isNewConfigEnabled) typeOption(
|
||||||
ExpiryType.LEGACY,
|
ExpiryType.LEGACY.defaultMode(persistedMode),
|
||||||
state,
|
state,
|
||||||
R.string.expiration_type_disappear_legacy,
|
R.string.expiration_type_disappear_legacy,
|
||||||
contentDescription = R.string.expiration_type_disappear_legacy_description,
|
contentDescription = R.string.expiration_type_disappear_legacy_description,
|
||||||
enabled = isSelfAdmin
|
enabled = isSelfAdmin
|
||||||
) else null,
|
) else null,
|
||||||
if (!isGroup) typeOption(
|
if (!isGroup) typeOption(
|
||||||
ExpiryType.AFTER_READ,
|
ExpiryType.AFTER_READ.defaultMode(persistedMode),
|
||||||
state,
|
state,
|
||||||
R.string.expiration_type_disappear_after_read,
|
R.string.expiration_type_disappear_after_read,
|
||||||
R.string.expiration_type_disappear_after_read_description,
|
R.string.expiration_type_disappear_after_read_description,
|
||||||
@ -244,7 +244,7 @@ private fun typeOptions(state: State) =
|
|||||||
enabled = isNewConfigEnabled && isSelfAdmin
|
enabled = isNewConfigEnabled && isSelfAdmin
|
||||||
) else null,
|
) else null,
|
||||||
typeOption(
|
typeOption(
|
||||||
ExpiryType.AFTER_SEND,
|
ExpiryType.AFTER_SEND.defaultMode(persistedMode),
|
||||||
state,
|
state,
|
||||||
R.string.expiration_type_disappear_after_send,
|
R.string.expiration_type_disappear_after_send,
|
||||||
R.string.expiration_type_disappear_after_read_description,
|
R.string.expiration_type_disappear_after_read_description,
|
||||||
@ -254,21 +254,6 @@ private fun typeOptions(state: State) =
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun typeOption(
|
|
||||||
type: ExpiryType,
|
|
||||||
state: State,
|
|
||||||
@StringRes title: Int,
|
|
||||||
@StringRes subtitle: Int? = null,
|
|
||||||
@StringRes contentDescription: Int = title,
|
|
||||||
enabled: Boolean = true,
|
|
||||||
) = typeOption(
|
|
||||||
mode = type.defaultMode(state.persistedMode),
|
|
||||||
state = state,
|
|
||||||
title = title,
|
|
||||||
subtitle = subtitle,
|
|
||||||
contentDescription = contentDescription,
|
|
||||||
enabled = enabled
|
|
||||||
)
|
|
||||||
private fun typeOption(
|
private fun typeOption(
|
||||||
mode: ExpiryMode,
|
mode: ExpiryMode,
|
||||||
state: State,
|
state: State,
|
||||||
@ -276,26 +261,27 @@ private fun typeOption(
|
|||||||
@StringRes subtitle: Int? = null,
|
@StringRes subtitle: Int? = null,
|
||||||
@StringRes contentDescription: Int = title,
|
@StringRes contentDescription: Int = title,
|
||||||
enabled: Boolean = true,
|
enabled: Boolean = true,
|
||||||
onClick: Action = Action.SelectMode(mode)
|
|
||||||
) = OptionModel(
|
) = OptionModel(
|
||||||
GetString(title),
|
value = mode,
|
||||||
subtitle?.let(::GetString),
|
title = GetString(title),
|
||||||
|
subtitle = subtitle?.let(::GetString),
|
||||||
|
contentDescription = GetString(contentDescription),
|
||||||
selected = state.expiryType == mode.type,
|
selected = state.expiryType == mode.type,
|
||||||
enabled = enabled,
|
enabled = enabled
|
||||||
onClick = onClick
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun debugTimes(isDebug: Boolean) = if (isDebug) listOf(10.seconds, 1.minutes) else emptyList()
|
private fun debugTimes(isDebug: Boolean) = if (isDebug) listOf(10.seconds, 1.minutes) else emptyList()
|
||||||
private fun debugModes(isDebug: Boolean, type: ExpiryType) =
|
private fun debugModes(isDebug: Boolean, type: ExpiryType) =
|
||||||
debugTimes(isDebug).map { type.mode(it.inWholeSeconds) }
|
debugTimes(isDebug).map { type.mode(it.inWholeSeconds) }
|
||||||
private fun debugOptions(state: State): List<OptionModel> =
|
private fun debugOptions(state: State): List<OptionModel> =
|
||||||
debugModes(state.showDebugOptions, state.expiryType.takeIf { it != ExpiryType.NONE } ?: ExpiryType.AFTER_SEND)
|
debugModes(state.showDebugOptions, state.expiryType.takeIf { it == ExpiryType.AFTER_READ } ?: ExpiryType.AFTER_SEND)
|
||||||
.map { timeOption(it, state, subtitle = GetString("for testing purposes")) }
|
.map { timeOption(it, state, subtitle = GetString("for testing purposes")) }
|
||||||
|
|
||||||
val defaultTimes = listOf(12.hours, 1.days, 7.days, 14.days)
|
val defaultTimes = listOf(12.hours, 1.days, 7.days, 14.days)
|
||||||
|
|
||||||
val afterSendTimes = defaultTimes
|
val afterSendTimes = defaultTimes
|
||||||
val afterSendModes = afterSendTimes.map { it.inWholeSeconds }.map(ExpiryMode::AfterSend)
|
val afterSendModes = afterSendTimes.map { it.inWholeSeconds }.map(ExpiryMode::AfterSend)
|
||||||
|
fun afterSendOptions(state: State) = afterSendModes.map { timeOption(it, state) }
|
||||||
|
|
||||||
val afterReadTimes = buildList {
|
val afterReadTimes = buildList {
|
||||||
add(5.minutes)
|
add(5.minutes)
|
||||||
@ -303,17 +289,18 @@ val afterReadTimes = buildList {
|
|||||||
addAll(defaultTimes)
|
addAll(defaultTimes)
|
||||||
}
|
}
|
||||||
val afterReadModes = afterReadTimes.map { it.inWholeSeconds }.map(ExpiryMode::AfterRead)
|
val afterReadModes = afterReadTimes.map { it.inWholeSeconds }.map(ExpiryMode::AfterRead)
|
||||||
|
fun afterReadOptions(state: State) = afterReadModes.map { timeOption(it, state) }
|
||||||
|
|
||||||
private fun timeOptions(state: State): List<OptionModel>? =
|
private fun timeOptions(state: State): List<OptionModel>? =
|
||||||
if (state.modeOptionsHidden) timeOptionsAfterSend(state)
|
if (state.modeOptionsHidden) timeOptionsAfterSend(state)
|
||||||
else when (state.expiryMode) {
|
else when (state.expiryMode) {
|
||||||
is ExpiryMode.Legacy, is ExpiryMode.AfterRead -> debugOptions(state) + afterReadModes.map { timeOption(it, state) }
|
is ExpiryMode.Legacy, is ExpiryMode.AfterRead -> debugOptions(state) + afterReadOptions(state)
|
||||||
is ExpiryMode.AfterSend -> debugOptions(state) + afterSendModes.map { timeOption(it, state) }
|
is ExpiryMode.AfterSend -> debugOptions(state) + afterSendOptions(state)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun timeOptionsAfterSend(state: State) = listOfNotNull(
|
private fun timeOptionsAfterSend(state: State) = listOf(
|
||||||
typeOption(ExpiryType.NONE, state, R.string.expiration_off, enabled = state.isSelfAdmin),
|
typeOption(ExpiryMode.NONE, state, R.string.expiration_off, enabled = state.isSelfAdmin),
|
||||||
) + debugOptions(state) + afterSendModes.map { timeOption(it, state) }
|
) + debugOptions(state) + afterSendModes.map { timeOption(it, state) }
|
||||||
|
|
||||||
private fun timeOption(
|
private fun timeOption(
|
||||||
@ -321,29 +308,21 @@ private fun timeOption(
|
|||||||
state: State,
|
state: State,
|
||||||
title: GetString = GetString(mode.duration, ExpirationUtil::getExpirationDisplayValue),
|
title: GetString = GetString(mode.duration, ExpirationUtil::getExpirationDisplayValue),
|
||||||
subtitle: GetString? = null,
|
subtitle: GetString? = null,
|
||||||
onClick: Action = Action.SelectMode(mode)
|
|
||||||
) = OptionModel(
|
) = OptionModel(
|
||||||
|
value = mode,
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
selected = state.expiryMode == mode,
|
selected = state.expiryMode == mode,
|
||||||
enabled = state.isTimeOptionsEnabled,
|
enabled = state.isTimeOptionsEnabled
|
||||||
onClick = onClick
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sealed interface Action {
|
|
||||||
operator fun invoke(callbacks: Callbacks) {}
|
|
||||||
|
|
||||||
data class SelectMode(val mode: ExpiryMode): Action {
|
|
||||||
override operator fun invoke(callbacks: Callbacks) = callbacks.setMode(mode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class OptionModel(
|
data class OptionModel(
|
||||||
|
val value: ExpiryMode,
|
||||||
val title: GetString,
|
val title: GetString,
|
||||||
val subtitle: GetString? = null,
|
val subtitle: GetString? = null,
|
||||||
|
val contentDescription: GetString = title,
|
||||||
val selected: Boolean = false,
|
val selected: Boolean = false,
|
||||||
val enabled: Boolean = true,
|
val enabled: Boolean = true,
|
||||||
val onClick: Action
|
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class ExpiryType(private val createMode: (Long) -> ExpiryMode) {
|
enum class ExpiryType(private val createMode: (Long) -> ExpiryMode) {
|
||||||
|
@ -257,7 +257,7 @@ fun RowScope.CarouselButton(
|
|||||||
onClick = { animationScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + delta) } }) {
|
onClick = { animationScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + delta) } }) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = id),
|
painter = painterResource(id = id),
|
||||||
contentDescription = "",
|
contentDescription = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@
|
|||||||
<string name="arrays__default">Default</string>
|
<string name="arrays__default">Default</string>
|
||||||
<string name="arrays__high">High</string>
|
<string name="arrays__high">High</string>
|
||||||
<string name="arrays__max">Max</string>
|
<string name="arrays__max">Max</string>
|
||||||
<string name="arrays__off">Off</string>
|
<string name="sarrays__off">Off</string>
|
||||||
<string name="arrays__five_minutes">5 Minutes</string>
|
<string name="arrays__five_minutes">5 Minutes</string>
|
||||||
<string name="arrays__one_hour">1 Hour</string>
|
<string name="arrays__one_hour">1 Hour</string>
|
||||||
<string name="arrays__twelve_hours">12 Hours</string>
|
<string name="arrays__twelve_hours">12 Hours</string>
|
||||||
|
@ -5,7 +5,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|||||||
import kotlinx.coroutines.test.advanceUntilIdle
|
import kotlinx.coroutines.test.advanceUntilIdle
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import network.loki.messenger.libsession_util.util.ExpiryMode
|
import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||||
import network.loki.messenger.R
|
|
||||||
import org.hamcrest.CoreMatchers
|
import org.hamcrest.CoreMatchers
|
||||||
import org.hamcrest.MatcherAssert
|
import org.hamcrest.MatcherAssert
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
@ -15,8 +14,6 @@ import org.mockito.Mockito.mock
|
|||||||
import org.mockito.kotlin.whenever
|
import org.mockito.kotlin.whenever
|
||||||
import org.session.libsession.messaging.messages.ExpirationConfiguration
|
import org.session.libsession.messaging.messages.ExpirationConfiguration
|
||||||
import org.session.libsession.utilities.Address
|
import org.session.libsession.utilities.Address
|
||||||
import org.session.libsession.utilities.GroupRecord
|
|
||||||
import org.session.libsession.utilities.GroupUtil.CLOSED_GROUP_PREFIX
|
|
||||||
import org.session.libsession.utilities.SSKEnvironment
|
import org.session.libsession.utilities.SSKEnvironment
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.recipients.Recipient
|
import org.session.libsession.utilities.recipients.Recipient
|
||||||
@ -26,8 +23,10 @@ import org.thoughtcrime.securesms.database.GroupDatabase
|
|||||||
import org.thoughtcrime.securesms.database.Storage
|
import org.thoughtcrime.securesms.database.Storage
|
||||||
import org.thoughtcrime.securesms.database.ThreadDatabase
|
import org.thoughtcrime.securesms.database.ThreadDatabase
|
||||||
import org.thoughtcrime.securesms.ui.GetString
|
import org.thoughtcrime.securesms.ui.GetString
|
||||||
import kotlin.time.Duration.Companion.days
|
|
||||||
import kotlin.time.Duration.Companion.hours
|
import kotlin.time.Duration.Companion.hours
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import kotlin.time.Duration
|
||||||
|
import kotlin.time.Duration.Companion.days
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
class ExpirationSettingsViewModelTest {
|
class ExpirationSettingsViewModelTest {
|
||||||
@ -42,12 +41,8 @@ class ExpirationSettingsViewModelTest {
|
|||||||
private val threadDb: ThreadDatabase = mock(ThreadDatabase::class.java)
|
private val threadDb: ThreadDatabase = mock(ThreadDatabase::class.java)
|
||||||
private val groupDb: GroupDatabase = mock(GroupDatabase::class.java)
|
private val groupDb: GroupDatabase = mock(GroupDatabase::class.java)
|
||||||
private val storage: Storage = mock(Storage::class.java)
|
private val storage: Storage = mock(Storage::class.java)
|
||||||
|
|
||||||
private val recipient = mock(Recipient::class.java)
|
private val recipient = mock(Recipient::class.java)
|
||||||
|
|
||||||
private val groupRecord = mock(GroupRecord::class.java)
|
|
||||||
private val optionalGroupRecord = Optional.of(groupRecord)
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `UI should show a list of times and an Off option`() = runTest {
|
fun `UI should show a list of times and an Off option`() = runTest {
|
||||||
val threadId = 1L
|
val threadId = 1L
|
||||||
@ -59,43 +54,75 @@ class ExpirationSettingsViewModelTest {
|
|||||||
)
|
)
|
||||||
whenever(threadDb.getRecipientForThreadId(Mockito.anyLong())).thenReturn(recipient)
|
whenever(threadDb.getRecipientForThreadId(Mockito.anyLong())).thenReturn(recipient)
|
||||||
whenever(storage.getExpirationConfiguration(Mockito.anyLong())).thenReturn(expirationConfig)
|
whenever(storage.getExpirationConfiguration(Mockito.anyLong())).thenReturn(expirationConfig)
|
||||||
|
whenever(textSecurePreferences.getLocalNumber()).thenReturn("05---LOCAL---ADDRESS")
|
||||||
|
|
||||||
val address = Address.fromSerialized("${CLOSED_GROUP_PREFIX}94198734289")
|
val userAddress = Address.fromSerialized(textSecurePreferences.getLocalNumber()!!)
|
||||||
|
val someAddress = Address.fromSerialized("05---SOME---ADDRESS")
|
||||||
|
|
||||||
whenever(recipient.isClosedGroupRecipient).thenReturn(true)
|
whenever(recipient.isClosedGroupRecipient).thenReturn(false)
|
||||||
whenever(recipient.address).thenReturn(address)
|
whenever(recipient.address).thenReturn(someAddress)
|
||||||
|
|
||||||
whenever(groupDb.getGroup(Mockito.anyString())).thenReturn(optionalGroupRecord)
|
whenever(groupDb.getGroup(Mockito.anyString())).thenReturn(Optional.absent())
|
||||||
|
|
||||||
val viewModel = createViewModel()
|
val viewModel = createViewModel()
|
||||||
|
|
||||||
advanceUntilIdle()
|
advanceUntilIdle()
|
||||||
|
|
||||||
val state = viewModel.state.value
|
|
||||||
|
|
||||||
MatcherAssert.assertThat(
|
MatcherAssert.assertThat(
|
||||||
state.isGroup,
|
viewModel.state.value,
|
||||||
CoreMatchers.equalTo(true)
|
|
||||||
)
|
|
||||||
|
|
||||||
MatcherAssert.assertThat(
|
|
||||||
viewModel.uiState.value.cards.count(),
|
|
||||||
CoreMatchers.equalTo(1)
|
|
||||||
)
|
|
||||||
|
|
||||||
val options = viewModel.uiState.value.cards[0].options
|
|
||||||
MatcherAssert.assertThat(
|
|
||||||
options.map { it.title },
|
|
||||||
CoreMatchers.equalTo(
|
CoreMatchers.equalTo(
|
||||||
listOf(
|
State(
|
||||||
GetString(R.string.expiration_off),
|
isGroup = false,
|
||||||
GetString(12.hours),
|
isSelfAdmin = true,
|
||||||
GetString(1.days),
|
address = someAddress,
|
||||||
GetString(7.days),
|
isNoteToSelf = false,
|
||||||
GetString(14.days)
|
expiryMode = ExpiryMode.AfterSend(12.hours.inWholeSeconds),
|
||||||
|
isNewConfigEnabled = true,
|
||||||
|
persistedMode = ExpiryMode.AfterSend(12.hours.inWholeSeconds),
|
||||||
|
showDebugOptions = false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val uiState = viewModel.uiState.value
|
||||||
|
|
||||||
|
MatcherAssert.assertThat(
|
||||||
|
uiState.cards.map { it.title },
|
||||||
|
CoreMatchers.equalTo(
|
||||||
|
listOf(
|
||||||
|
R.string.activity_expiration_settings_delete_type,
|
||||||
|
R.string.activity_expiration_settings_timer
|
||||||
|
).map(::GetString)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
MatcherAssert.assertThat(
|
||||||
|
uiState.cards[0].options.map { it.title },
|
||||||
|
CoreMatchers.equalTo(
|
||||||
|
listOf(
|
||||||
|
R.string.expiration_off,
|
||||||
|
R.string.expiration_type_disappear_after_read,
|
||||||
|
R.string.expiration_type_disappear_after_send,
|
||||||
|
).map(::GetString)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
MatcherAssert.assertThat(
|
||||||
|
uiState.cards[1].options.map { it.title },
|
||||||
|
CoreMatchers.equalTo(
|
||||||
|
listOf(
|
||||||
|
12.hours,
|
||||||
|
1.days,
|
||||||
|
7.days,
|
||||||
|
14.days,
|
||||||
|
).map(::GetString)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
MatcherAssert.assertThat(
|
||||||
|
uiState.showGroupFooter,
|
||||||
|
CoreMatchers.equalTo(false)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createViewModel(isNewConfigEnabled: Boolean = true) = ExpirationSettingsViewModel(
|
private fun createViewModel(isNewConfigEnabled: Boolean = true) = ExpirationSettingsViewModel(
|
||||||
|
@ -46,7 +46,7 @@ dependencies {
|
|||||||
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
|
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
|
||||||
testImplementation "junit:junit:$junitVersion"
|
testImplementation "junit:junit:$junitVersion"
|
||||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||||
testImplementation "org.mockito:mockito-inline:4.0.0"
|
testImplementation "org.mockito:mockito-inline:4.11.0"
|
||||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||||
testImplementation "androidx.test:core:$testCoreVersion"
|
testImplementation "androidx.test:core:$testCoreVersion"
|
||||||
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user