[MatrixSDK] make tests passes
This commit is contained in:
parent
38dc36e7bf
commit
dc8cfcdb8e
5 changed files with 10 additions and 6 deletions
|
|
@ -17,9 +17,9 @@
|
||||||
package io.element.android.features.login.impl.error
|
package io.element.android.features.login.impl.error
|
||||||
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import io.element.android.libraries.matrix.api.auth.AuthenticationException
|
||||||
import io.element.android.libraries.ui.strings.R
|
import io.element.android.libraries.ui.strings.R
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.AuthenticationException
|
|
||||||
|
|
||||||
class ErrorFormatterTests {
|
class ErrorFormatterTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ private fun aMessageEvent(
|
||||||
) = TimelineItem.Event(
|
) = TimelineItem.Event(
|
||||||
id = AN_EVENT_ID.value,
|
id = AN_EVENT_ID.value,
|
||||||
eventId = AN_EVENT_ID,
|
eventId = AN_EVENT_ID,
|
||||||
senderId = A_USER_ID.value,
|
senderId = A_USER_ID,
|
||||||
senderDisplayName = A_USER_NAME,
|
senderDisplayName = A_USER_NAME,
|
||||||
senderAvatar = AvatarData(A_USER_ID.value, A_USER_NAME),
|
senderAvatar = AvatarData(A_USER_ID.value, A_USER_NAME),
|
||||||
content = content,
|
content = content,
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ internal fun aMessageEvent(
|
||||||
) = TimelineItem.Event(
|
) = TimelineItem.Event(
|
||||||
id = AN_EVENT_ID.value,
|
id = AN_EVENT_ID.value,
|
||||||
eventId = AN_EVENT_ID,
|
eventId = AN_EVENT_ID,
|
||||||
senderId = A_USER_ID.value,
|
senderId = A_USER_ID,
|
||||||
senderDisplayName = A_USER_NAME,
|
senderDisplayName = A_USER_NAME,
|
||||||
senderAvatar = AvatarData(A_USER_ID.value, A_USER_NAME),
|
senderAvatar = AvatarData(A_USER_ID.value, A_USER_NAME),
|
||||||
content = content,
|
content = content,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package io.element.android.libraries.matrix.api.auth
|
||||||
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.AuthenticationException
|
|
||||||
|
|
||||||
class AuthErrorCodeTests {
|
class AuthErrorCodeTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,13 @@ class FakeAuthenticationService : MatrixAuthenticationService {
|
||||||
|
|
||||||
override suspend fun login(username: String, password: String): Result<SessionId> {
|
override suspend fun login(username: String, password: String): Result<SessionId> {
|
||||||
delay(100)
|
delay(100)
|
||||||
loginError?.let { throw it }
|
return loginError.let { loginError ->
|
||||||
return Result.success(A_USER_ID)
|
if (loginError == null) {
|
||||||
|
Result.success(A_USER_ID)
|
||||||
|
} else {
|
||||||
|
Result.failure(loginError)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun givenLoginError(throwable: Throwable?) {
|
fun givenLoginError(throwable: Throwable?) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue