Fixing unit tests after rebase
This commit is contained in:
parent
dcca546c4b
commit
7ddec674fb
@ -21,7 +21,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Test
|
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.Event
|
||||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.events.model.toContent
|
import org.matrix.android.sdk.api.session.events.model.toContent
|
||||||
@ -87,7 +86,7 @@ class DefaultStopLiveLocationShareTaskTest {
|
|||||||
fakeStateEventDataSource.verifyGetStateEvent(
|
fakeStateEventDataSource.verifyGetStateEvent(
|
||||||
roomId = params.roomId,
|
roomId = params.roomId,
|
||||||
eventType = EventType.STATE_ROOM_BEACON_INFO.first(),
|
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
|
every { isNotNull(fieldName) } returns this
|
||||||
return 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
|
} returns event
|
||||||
}
|
}
|
||||||
|
|
||||||
fun verifyGetStateEvent(roomId: String, eventType: String, stateKey: QueryStringValue) {
|
fun verifyGetStateEvent(roomId: String, eventType: String, stateKey: String) {
|
||||||
verify {
|
verify {
|
||||||
instance.getStateEvent(
|
instance.getStateEvent(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
eventType = eventType,
|
eventType = eventType,
|
||||||
stateKey = stateKey
|
stateKey = QueryStringValue.Equals(stateKey)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user