Fix tests.

This commit is contained in:
Benoit Marty
2025-08-13 10:35:46 +02:00
parent 18e95578ce
commit 9d8f670323
2 changed files with 17 additions and 18 deletions

View File

@@ -52,6 +52,21 @@ class DeveloperSettingsViewTest {
}
}
@Config(qualifiers = "h1500dp")
@Test
fun `clicking on push history notification invokes the expected callback`() {
val eventsRecorder = EventsRecorder<DeveloperSettingsEvents>(expectEvents = false)
ensureCalledOnce {
rule.setDeveloperSettingsView(
state = aDeveloperSettingsState(
eventSink = eventsRecorder
),
onPushHistoryClick = it
)
rule.clickOn(R.string.troubleshoot_notifications_entry_point_push_history_title)
}
}
@Config(qualifiers = "h1500dp")
@Test
fun `clicking on element call url open the dialogs and submit emits the expected event`() {
@@ -114,12 +129,14 @@ class DeveloperSettingsViewTest {
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setDeveloperSettingsView(
state: DeveloperSettingsState,
onOpenShowkase: () -> Unit = EnsureNeverCalled(),
onPushHistoryClick: () -> Unit = EnsureNeverCalled(),
onBackClick: () -> Unit = EnsureNeverCalled()
) {
setContent {
DeveloperSettingsView(
state = state,
onOpenShowkase = onOpenShowkase,
onPushHistoryClick = onPushHistoryClick,
onBackClick = onBackClick,
)
}

View File

@@ -66,22 +66,6 @@ class NotificationSettingsViewTest {
eventsRecorder.assertSingle(NotificationSettingsEvents.RefreshSystemNotificationsEnabled)
}
@Config(qualifiers = "h1024dp")
@Test
fun `clicking on push history notification invokes the expected callback`() {
val eventsRecorder = EventsRecorder<NotificationSettingsEvents>()
ensureCalledOnce {
rule.setNotificationSettingsView(
state = aValidNotificationSettingsState(
eventSink = eventsRecorder
),
onPushHistoryClick = it
)
rule.clickOn(R.string.troubleshoot_notifications_entry_point_push_history_title)
}
eventsRecorder.assertSingle(NotificationSettingsEvents.RefreshSystemNotificationsEnabled)
}
@Config(qualifiers = "h1024dp")
@Test
fun `clicking on group chats invokes the expected callback`() {
@@ -300,7 +284,6 @@ private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setNotif
state: NotificationSettingsState,
onOpenEditDefault: (isOneToOne: Boolean) -> Unit = EnsureNeverCalledWithParam(),
onTroubleshootNotificationsClick: () -> Unit = EnsureNeverCalled(),
onPushHistoryClick: () -> Unit = EnsureNeverCalled(),
onBackClick: () -> Unit = EnsureNeverCalled(),
) {
setContent {
@@ -308,7 +291,6 @@ private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setNotif
state = state,
onOpenEditDefault = onOpenEditDefault,
onTroubleshootNotificationsClick = onTroubleshootNotificationsClick,
onPushHistoryClick = onPushHistoryClick,
onBackClick = onBackClick,
)
}