Introduce runAndTestState extension on NotificationTroubleshootTest
This commit is contained in:
parent
bfc770d46e
commit
194340b19c
13 changed files with 73 additions and 144 deletions
|
|
@ -15,4 +15,7 @@ android {
|
|||
dependencies {
|
||||
implementation(projects.libraries.troubleshoot.api)
|
||||
implementation(projects.tests.testutils)
|
||||
implementation(libs.coroutines.test)
|
||||
implementation(libs.test.core)
|
||||
implementation(libs.test.turbine)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.troubleshoot.test
|
||||
|
||||
import app.cash.turbine.TurbineTestContext
|
||||
import app.cash.turbine.test
|
||||
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTest
|
||||
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.test.TestScope
|
||||
|
||||
context(testScope: TestScope)
|
||||
suspend fun NotificationTroubleshootTest.runAndTestState(
|
||||
validate: suspend TurbineTestContext<NotificationTroubleshootTestState>.() -> Unit,
|
||||
) {
|
||||
testScope.backgroundScope.launch {
|
||||
run(this)
|
||||
}
|
||||
state.test(validate = validate)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue