mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-14 21:09:24 +00:00
add tests for cruds
This commit is contained in:
@@ -14,5 +14,10 @@ kotlin {
|
||||
api internalProject("micro_utils.coroutines")
|
||||
}
|
||||
}
|
||||
commonTest {
|
||||
dependencies {
|
||||
api project(":micro_utils.repos.common.tests")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package full
|
||||
|
||||
import CommonCRUDRepoTests
|
||||
import com.benasher44.uuid.uuid4
|
||||
import dev.inmo.micro_utils.repos.CRUDRepo
|
||||
import dev.inmo.micro_utils.repos.MapCRUDRepo
|
||||
import kotlinx.coroutines.test.TestResult
|
||||
import kotlin.test.*
|
||||
|
||||
class InMemoryCRUDRepoTests : CommonCRUDRepoTests() {
|
||||
override val repoCreator: suspend () -> CRUDRepo<Registered, String, New> = {
|
||||
MapCRUDRepo(
|
||||
{ new, id, old ->
|
||||
Registered(id, new.data)
|
||||
}
|
||||
) {
|
||||
val id = uuid4().toString()
|
||||
id to Registered(id, it.data)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
override fun creatingWorksProperly(): TestResult {
|
||||
return super.creatingWorksProperly()
|
||||
}
|
||||
|
||||
@Test
|
||||
override fun removingWorksProperly(): TestResult {
|
||||
return super.removingWorksProperly()
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package full
|
||||
|
||||
import CommonKeyValueRepoTests
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import kotlinx.coroutines.test.TestResult
|
||||
import kotlin.test.*
|
||||
|
||||
class InMemoryKeyValueRepoTests : CommonKeyValueRepoTests() {
|
||||
override val repoCreator: suspend () -> KeyValueRepo<String, String> = { MapKeyValueRepo() }
|
||||
|
||||
@Test
|
||||
override fun creatingWorksProperly(): TestResult {
|
||||
return super.creatingWorksProperly()
|
||||
}
|
||||
|
||||
@Test
|
||||
override fun unsettingWorksProperly(): TestResult {
|
||||
return super.unsettingWorksProperly()
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package full
|
||||
|
||||
import CommonKeyValuesRepoTests
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import kotlinx.coroutines.test.TestResult
|
||||
import kotlin.test.*
|
||||
|
||||
class InMemoryKeyValuesRepoTests : CommonKeyValuesRepoTests() {
|
||||
override val repoCreator: suspend () -> KeyValuesRepo<String, String> = { MapKeyValuesRepo() }
|
||||
@Test
|
||||
override fun creatingWorksProperly(): TestResult {
|
||||
return super.creatingWorksProperly()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user