Fixing unit tests after rebase

This commit is contained in:
Maxime NATUREL 2022-06-20 10:16:27 +02:00
parent dcca546c4b
commit 7ddec674fb
3 changed files with 3 additions and 47 deletions

View File

@ -21,7 +21,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.After
import org.junit.Test
import org.matrix.android.sdk.api.query.QueryStringValue
import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.toContent
@ -87,7 +86,7 @@ class DefaultStopLiveLocationShareTaskTest {
fakeStateEventDataSource.verifyGetStateEvent(
roomId = params.roomId,
eventType = EventType.STATE_ROOM_BEACON_INFO.first(),
stateKey = QueryStringValue.Equals(A_USER_ID)
stateKey = A_USER_ID
)
}
}

View File

@ -97,46 +97,3 @@ inline fun <reified T : RealmModel> RealmQuery<T>.givenIsNotNull(
every { isNotNull(fieldName) } returns this
return this
}
inline fun <reified T : RealmModel> RealmQuery<T>.givenFindFirst(
result: T?
): RealmQuery<T> {
every { findFirst() } returns result
return this
}
inline fun <reified T : RealmModel> RealmQuery<T>.givenFindAll(
result: List<T>
): RealmQuery<T> {
val realmResults = mockk<RealmResults<T>>()
result.forEachIndexed { index, t ->
every { realmResults[index] } returns t
}
every { realmResults.size } returns result.size
every { findAll() } returns realmResults
return this
}
inline fun <reified T : RealmModel> RealmQuery<T>.givenEqualTo(
fieldName: String,
value: String
): RealmQuery<T> {
every { equalTo(fieldName, value) } returns this
return this
}
inline fun <reified T : RealmModel> RealmQuery<T>.givenEqualTo(
fieldName: String,
value: Boolean
): RealmQuery<T> {
every { equalTo(fieldName, value) } returns this
return this
}
inline fun <reified T : RealmModel> RealmQuery<T>.givenNotEqualTo(
fieldName: String,
value: String
): RealmQuery<T> {
every { notEqualTo(fieldName, value) } returns this
return this
}

View File

@ -37,12 +37,12 @@ internal class FakeStateEventDataSource {
} returns event
}
fun verifyGetStateEvent(roomId: String, eventType: String, stateKey: QueryStringValue) {
fun verifyGetStateEvent(roomId: String, eventType: String, stateKey: String) {
verify {
instance.getStateEvent(
roomId = roomId,
eventType = eventType,
stateKey = stateKey
stateKey = QueryStringValue.Equals(stateKey)
)
}
}