mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Fix unit tests after rebase
This commit is contained in:
parent
dcca546c4b
commit
b16ccf5098
3 changed files with 3 additions and 47 deletions
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue