Deletes migration test
This commit is contained in:
parent
e926871570
commit
6f9b5c010d
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.internal.database.migration
|
||||
|
||||
import org.junit.Test
|
||||
import org.matrix.android.sdk.internal.database.model.RoomSummaryEntityFields
|
||||
import org.matrix.android.sdk.test.fakes.FakeDynamicRealm
|
||||
|
||||
internal class MigrateSessionTo033Test {
|
||||
|
||||
private val fakeDynamicRealm = FakeDynamicRealm()
|
||||
private val migrator = MigrateSessionTo033(fakeDynamicRealm.instance)
|
||||
|
||||
@Test
|
||||
fun `when doMigrate, then directParentNames added`() {
|
||||
migrator.doMigrate(fakeDynamicRealm.instance)
|
||||
|
||||
fakeDynamicRealm.fakeRealmSchema.withObjectSchema("RoomSummaryEntity")
|
||||
.verifyListFieldAdded(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, String::class.java)
|
||||
.verifyStringTransformation(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, "")
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.test.fakes
|
||||
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.realm.DynamicRealm
|
||||
|
||||
class FakeDynamicRealm(
|
||||
val fakeRealmSchema: FakeRealmSchema = FakeRealmSchema()
|
||||
) {
|
||||
|
||||
val instance: DynamicRealm = mockk {
|
||||
every { schema } returns fakeRealmSchema.instance
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.test.fakes
|
||||
|
||||
import io.mockk.justRun
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import io.realm.DynamicRealmObject
|
||||
|
||||
class FakeDynamicRealmObject {
|
||||
|
||||
val instance: DynamicRealmObject = mockk {
|
||||
justRun { setString(any(), any()) }
|
||||
}
|
||||
|
||||
fun verifySetString(fieldName: String, value: String) {
|
||||
verify { instance.setString(fieldName, value) }
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.test.fakes
|
||||
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.slot
|
||||
import io.mockk.verify
|
||||
import io.realm.RealmObjectSchema
|
||||
import io.realm.RealmObjectSchema.Function
|
||||
|
||||
class FakeRealmObjectSchema(
|
||||
private val fakeDynamicRealmObject: FakeDynamicRealmObject = FakeDynamicRealmObject()
|
||||
) {
|
||||
|
||||
val instance: RealmObjectSchema = mockk {
|
||||
every { addRealmListField(any(), any<Class<*>>()) } returns this
|
||||
every { transform(any()) } returns this
|
||||
}
|
||||
|
||||
fun verifyListFieldAdded(fieldName: String, type: Class<*>) = apply {
|
||||
verify { instance.addRealmListField(fieldName, type) }
|
||||
}
|
||||
|
||||
fun verifyStringTransformation(fieldName: String, transformedInto: String) = apply {
|
||||
val transformationSlot = slot<Function>()
|
||||
verify { instance.transform(capture(transformationSlot)) }
|
||||
transformationSlot.captured.apply(fakeDynamicRealmObject.instance)
|
||||
fakeDynamicRealmObject.verifySetString(fieldName, transformedInto)
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.test.fakes
|
||||
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import io.realm.RealmSchema
|
||||
|
||||
class FakeRealmSchema(
|
||||
private val fakeRealmObjectSchema: FakeRealmObjectSchema = FakeRealmObjectSchema()
|
||||
) {
|
||||
|
||||
val instance: RealmSchema = mockk {
|
||||
every { this@mockk.get(any()) } returns fakeRealmObjectSchema.instance
|
||||
}
|
||||
|
||||
fun withObjectSchema(className: String): FakeRealmObjectSchema {
|
||||
verify { instance.get(className) }
|
||||
return fakeRealmObjectSchema
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue