Merge pull request #1465 from vector-im/feature/bma/codeCoverage

Improve code coverage
This commit is contained in:
Benoit Marty 2023-10-02 10:18:31 +02:00 committed by GitHub
commit de39179b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 184 additions and 99 deletions

View file

@ -36,6 +36,7 @@ class FakeAuthenticationService : MatrixAuthenticationService {
private var oidcCancelError: Throwable? = null
private var loginError: Throwable? = null
private var changeServerError: Throwable? = null
private var matrixClient: MatrixClient? = null
override fun isLoggedIn(): Flow<Boolean> {
return flowOf(false)
@ -46,7 +47,11 @@ class FakeAuthenticationService : MatrixAuthenticationService {
}
override suspend fun restoreSession(sessionId: SessionId): Result<MatrixClient> {
return Result.failure(IllegalStateException())
return if (matrixClient != null) {
Result.success(matrixClient!!)
} else {
Result.failure(IllegalStateException())
}
}
override fun getHomeserverDetails(): StateFlow<MatrixHomeServerDetails?> {
@ -92,4 +97,8 @@ class FakeAuthenticationService : MatrixAuthenticationService {
fun givenChangeServerError(throwable: Throwable?) {
changeServerError = throwable
}
fun givenMatrixClient(matrixClient: MatrixClient) {
this.matrixClient = matrixClient
}
}