Skip to content

Commit

Permalink
Fix unit tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime NATUREL committed Jun 20, 2022
1 parent dcca546 commit b16ccf5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}
}
Expand Down

0 comments on commit b16ccf5

Please sign in to comment.