Cleanup testImplementation dependencies (#4790)

This commit is contained in:
Benoit Marty 2025-06-02 10:51:02 +02:00 committed by GitHub
parent 9d4602dae7
commit 0b5e816f0d
25 changed files with 409 additions and 93 deletions

View file

@ -0,0 +1,20 @@
/*
* 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.
*/
plugins {
id("io.element.android-library")
}
android {
namespace = "io.element.android.libraries.oidc.test"
}
dependencies {
implementation(libs.coroutines.core)
api(projects.libraries.oidc.api)
implementation(projects.tests.testutils)
}

View file

@ -0,0 +1,21 @@
/*
* 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.oidc.test
import android.content.Intent
import io.element.android.libraries.oidc.api.OidcAction
import io.element.android.libraries.oidc.api.OidcIntentResolver
import io.element.android.tests.testutils.lambda.lambdaError
class FakeOidcIntentResolver(
private val resolveResult: (Intent) -> OidcAction? = { lambdaError() }
) : OidcIntentResolver {
override fun resolve(intent: Intent): OidcAction? {
return resolveResult(intent)
}
}

View file

@ -0,0 +1,32 @@
/*
* 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.oidc.test.customtab
import io.element.android.libraries.oidc.api.OidcAction
import io.element.android.libraries.oidc.api.OidcActionFlow
import kotlinx.coroutines.flow.FlowCollector
import kotlinx.coroutines.flow.MutableStateFlow
/**
* This is actually a copy of DefaultOidcActionFlow.
*/
class FakeOidcActionFlow : OidcActionFlow {
private val mutableStateFlow = MutableStateFlow<OidcAction?>(null)
override fun post(oidcAction: OidcAction) {
mutableStateFlow.value = oidcAction
}
override suspend fun collect(collector: FlowCollector<OidcAction?>) {
mutableStateFlow.collect(collector)
}
override fun reset() {
mutableStateFlow.value = null
}
}