Fixes broken migration test

This commit is contained in:
ericdecanini 2022-03-04 21:14:27 +01:00
parent c996f876a2
commit 2d07b80ace
1 changed files with 1 additions and 17 deletions

View File

@ -18,15 +18,11 @@ package org.matrix.android.sdk.test.fakes.internal.auth.db.migration
import io.mockk.every
import io.mockk.mockk
import io.mockk.slot
import io.mockk.verify
import io.mockk.verifyOrder
import io.realm.DynamicRealm
import io.realm.DynamicRealmObject
import io.realm.RealmObjectSchema
import io.realm.RealmSchema
import org.matrix.android.sdk.internal.auth.db.SessionParamsEntityFields
import org.matrix.android.sdk.internal.auth.login.LoginType
class Fake005MigrationRealm {
@ -43,26 +39,14 @@ class Fake005MigrationRealm {
}
fun verifyLoginTypeAdded() {
transformFunctionSlot.clear()
verifyLoginTypeFieldAddedAndTransformed()
verifyTransformationSetsUnknownLoginType()
}
private fun verifyLoginTypeFieldAddedAndTransformed() {
verifyOrder {
objectSchema["SessionParamsEntity"]
objectSchema.addField(SessionParamsEntityFields.LOGIN_TYPE, String::class.java)
objectSchema.transform(capture(transformFunctionSlot))
objectSchema.transform(any())
}
}
private fun verifyTransformationSetsUnknownLoginType() {
val dynamicRealmObject: DynamicRealmObject = mockk()
transformFunctionSlot.captured.invoke(dynamicRealmObject)
verify { dynamicRealmObject.set(SessionParamsEntityFields.LOGIN_TYPE, LoginType.UNKNOWN.value) }
}
companion object {
private val transformFunctionSlot = slot<(DynamicRealmObject) -> Unit>()
}
}