Merge pull request #1465 from vector-im/feature/bma/codeCoverage
Improve code coverage
This commit is contained in:
commit
de39179b9d
53 changed files with 184 additions and 99 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue