WIP on integration tests
This commit is contained in:
43
src/integration-test/kotlin/CustomSQLiteIT.kt
Normal file
43
src/integration-test/kotlin/CustomSQLiteIT.kt
Normal file
@@ -0,0 +1,43 @@
|
||||
package solutions.bitbadger.documents
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Test
|
||||
import solutions.bitbadger.documents.query.Definition
|
||||
import solutions.bitbadger.documents.query.Find
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
|
||||
class CustomSQLiteIT {
|
||||
|
||||
private val tbl = "test_table";
|
||||
|
||||
@BeforeEach
|
||||
fun setUp() {
|
||||
Configuration.connectionString = "jdbc:sqlite:memory"
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the dialect
|
||||
*/
|
||||
@AfterEach
|
||||
fun cleanUp() {
|
||||
Configuration.dialectValue = null
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("list succeeds with empty list")
|
||||
fun listEmpty() {
|
||||
Configuration.dbConn().use { conn ->
|
||||
conn.customNonQuery(Definition.ensureTable(tbl), listOf())
|
||||
conn.customNonQuery(Definition.ensureKey(tbl, Dialect.SQLITE), listOf())
|
||||
val result = conn.customList<TestDocument>(Find.all(tbl), listOf(), Results::fromData)
|
||||
assertEquals(0, result.size, "There should have been no results")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class TestDocument(val id: String)
|
||||
Reference in New Issue
Block a user