From cfa63156e2d5f43c2caa2f0a4d18d2bf33a2e3a8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 25 Aug 2026 10:33:16 +0200 Subject: [PATCH] `TroubleshootNotificationsEvents` -> `TroubleshootNotificationsEvent` --- ...ts.kt => TroubleshootNotificationsEvent.kt} | 8 ++++---- .../impl/TroubleshootNotificationsPresenter.kt | 8 ++++---- .../impl/TroubleshootNotificationsState.kt | 2 +- ...oubleshootNotificationsStatePreviewParam.kt | 2 +- .../impl/TroubleshootNotificationsView.kt | 6 +++--- .../TroubleshootNotificationsPresenterTest.kt | 6 +++--- .../impl/TroubleshootNotificationsViewTest.kt | 18 +++++++++--------- 7 files changed, 25 insertions(+), 25 deletions(-) rename libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/{TroubleshootNotificationsEvents.kt => TroubleshootNotificationsEvent.kt} (76%) diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsEvents.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsEvent.kt similarity index 76% rename from libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsEvents.kt rename to libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsEvent.kt index 94330907ea..a8ac210dd8 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsEvents.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsEvent.kt @@ -8,8 +8,8 @@ package io.element.android.libraries.troubleshoot.impl -sealed interface TroubleshootNotificationsEvents { - data object StartTests : TroubleshootNotificationsEvents - data object RetryFailedTests : TroubleshootNotificationsEvents - data class QuickFix(val testIndex: Int) : TroubleshootNotificationsEvents +sealed interface TroubleshootNotificationsEvent { + data object StartTests : TroubleshootNotificationsEvent + data object RetryFailedTests : TroubleshootNotificationsEvent + data class QuickFix(val testIndex: Int) : TroubleshootNotificationsEvent } diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenter.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenter.kt index 00958b1f99..a2c3cc9a58 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenter.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenter.kt @@ -38,19 +38,19 @@ class TroubleshootNotificationsPresenter( } val testSuiteState by troubleshootTestSuite.state.collectAsState() - fun handleEvent(event: TroubleshootNotificationsEvents) { + fun handleEvent(event: TroubleshootNotificationsEvent) { when (event) { - TroubleshootNotificationsEvents.StartTests -> coroutineScope.launch { + TroubleshootNotificationsEvent.StartTests -> coroutineScope.launch { troubleshootTestSuite.runTestSuite(this) } - is TroubleshootNotificationsEvents.QuickFix -> coroutineScope.launch { + is TroubleshootNotificationsEvent.QuickFix -> coroutineScope.launch { troubleshootTestSuite.quickFix( testIndex = event.testIndex, coroutineScope = this, navigator = navigator, ) } - TroubleshootNotificationsEvents.RetryFailedTests -> coroutineScope.launch { + TroubleshootNotificationsEvent.RetryFailedTests -> coroutineScope.launch { troubleshootTestSuite.retryFailedTest(this) } } diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsState.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsState.kt index 92f4d668c4..b6ce940a9f 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsState.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsState.kt @@ -10,7 +10,7 @@ package io.element.android.libraries.troubleshoot.impl data class TroubleshootNotificationsState( val testSuiteState: TroubleshootTestSuiteState, - val eventSink: (TroubleshootNotificationsEvents) -> Unit, + val eventSink: (TroubleshootNotificationsEvent) -> Unit, ) { val hasFailedTests: Boolean = testSuiteState.mainState.isFailure() } diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsStatePreviewParam.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsStatePreviewParam.kt index 54dd40617f..1f1aef6767 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsStatePreviewParam.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsStatePreviewParam.kt @@ -78,7 +78,7 @@ open class TroubleshootNotificationsStatePreviewParam : PreviewParameterProvider fun aTroubleshootNotificationsState( tests: List = emptyList(), - eventSink: (TroubleshootNotificationsEvents) -> Unit = {}, + eventSink: (TroubleshootNotificationsEvent) -> Unit = {}, ) = TroubleshootNotificationsState( eventSink = eventSink, testSuiteState = TroubleshootTestSuiteState( diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsView.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsView.kt index d168cfd764..f6b085bc14 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsView.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsView.kt @@ -44,7 +44,7 @@ fun TroubleshootNotificationsView( when (event) { Lifecycle.Event.ON_RESUME -> { if (state.hasFailedTests) { - state.eventSink(TroubleshootNotificationsEvents.RetryFailedTests) + state.eventSink(TroubleshootNotificationsEvent.RetryFailedTests) } } else -> Unit @@ -129,7 +129,7 @@ private fun ColumnScope.TroubleshootNotificationsContent(state: TroubleshootNoti TestSuiteView( testSuiteState = state.testSuiteState, onQuickFixClick = { - state.eventSink(TroubleshootNotificationsEvents.QuickFix(it)) + state.eventSink(TroubleshootNotificationsEvent.QuickFix(it)) } ) } @@ -181,7 +181,7 @@ private fun RunTestButton(state: TroubleshootNotificationsState) { } ), onClick = { - state.eventSink(TroubleshootNotificationsEvents.StartTests) + state.eventSink(TroubleshootNotificationsEvent.StartTests) }, modifier = Modifier.fillMaxWidth(), ) diff --git a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenterTest.kt b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenterTest.kt index c8f8382ecf..32ab07883b 100644 --- a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenterTest.kt +++ b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsPresenterTest.kt @@ -42,7 +42,7 @@ class TroubleshootNotificationsPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(TroubleshootNotificationsEvents.StartTests) + initialState.eventSink(TroubleshootNotificationsEvent.StartTests) skipItems(1) val stateAfterStart = awaitItem() assertThat(stateAfterStart.testSuiteState.mainState).isEqualTo(AsyncAction.Loading) @@ -63,7 +63,7 @@ class TroubleshootNotificationsPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(TroubleshootNotificationsEvents.RetryFailedTests) + initialState.eventSink(TroubleshootNotificationsEvent.RetryFailedTests) skipItems(1) val stateAfterStart = awaitItem() assertThat(stateAfterStart.testSuiteState.mainState).isEqualTo(AsyncAction.Loading) @@ -160,7 +160,7 @@ class TroubleshootNotificationsPresenterTest { skipItems(1) val initialState = awaitItem() assertThat(initialState.testSuiteState.mainState).isInstanceOf(AsyncAction.Failure::class.java) - initialState.eventSink(TroubleshootNotificationsEvents.QuickFix(0)) + initialState.eventSink(TroubleshootNotificationsEvent.QuickFix(0)) val stateAfterStart = awaitItem() assertThat(stateAfterStart.testSuiteState.mainState).isEqualTo(AsyncAction.Loading) } diff --git a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsViewTest.kt b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsViewTest.kt index ea98aeabc6..b685eb2238 100644 --- a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsViewTest.kt +++ b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsViewTest.kt @@ -27,7 +27,7 @@ import org.robolectric.annotation.Config class TroubleshootNotificationsViewTest : RobolectricTest() { @Test fun `press menu back invokes the expected callback`() = runAndroidComposeUiTest { - val eventsRecorder = EventsRecorder(expectEvents = false) + val eventsRecorder = EventsRecorder(expectEvents = false) ensureCalledOnce { setTroubleshootNotificationsView( state = aTroubleshootNotificationsState( @@ -41,20 +41,20 @@ class TroubleshootNotificationsViewTest : RobolectricTest() { @Test fun `clicking on run test emits the expected Event`() = runAndroidComposeUiTest { - val eventsRecorder = EventsRecorder() + val eventsRecorder = EventsRecorder() setTroubleshootNotificationsView( aTroubleshootNotificationsState( eventSink = eventsRecorder ), ) onNodeWithText("Run tests").performClick() - eventsRecorder.assertSingle(TroubleshootNotificationsEvents.StartTests) + eventsRecorder.assertSingle(TroubleshootNotificationsEvent.StartTests) } @Config(qualifiers = "h1024dp") @Test fun `clicking on run test again emits the expected Event`() = runAndroidComposeUiTest { - val eventsRecorder = EventsRecorder() + val eventsRecorder = EventsRecorder() setTroubleshootNotificationsView( aTroubleshootNotificationsState( tests = listOf( @@ -68,8 +68,8 @@ class TroubleshootNotificationsViewTest : RobolectricTest() { onNodeWithText("Run tests again").performClick() eventsRecorder.assertList( listOf( - TroubleshootNotificationsEvents.RetryFailedTests, - TroubleshootNotificationsEvents.StartTests, + TroubleshootNotificationsEvent.RetryFailedTests, + TroubleshootNotificationsEvent.StartTests, ) ) } @@ -77,7 +77,7 @@ class TroubleshootNotificationsViewTest : RobolectricTest() { @Config(qualifiers = "h1024dp") @Test fun `clicking on quick fix emits the expected Event`() = runAndroidComposeUiTest { - val eventsRecorder = EventsRecorder() + val eventsRecorder = EventsRecorder() setTroubleshootNotificationsView( aTroubleshootNotificationsState( tests = listOf( @@ -91,8 +91,8 @@ class TroubleshootNotificationsViewTest : RobolectricTest() { onNodeWithText("Attempt to fix").performClick() eventsRecorder.assertList( listOf( - TroubleshootNotificationsEvents.RetryFailedTests, - TroubleshootNotificationsEvents.QuickFix(0), + TroubleshootNotificationsEvent.RetryFailedTests, + TroubleshootNotificationsEvent.QuickFix(0), ) ) }