47 lines
1.3 KiB
Kotlin
47 lines
1.3 KiB
Kotlin
package solutions.bitbadger.documents.integration.sqlite
|
|
|
|
import org.junit.jupiter.api.DisplayName
|
|
import org.junit.jupiter.api.assertThrows
|
|
import solutions.bitbadger.documents.common.DocumentException
|
|
import solutions.bitbadger.documents.integration.common.Delete
|
|
import kotlin.test.Test
|
|
|
|
/**
|
|
* SQLite integration tests for the `Delete` object / `deleteBy*` connection extension functions
|
|
*/
|
|
@DisplayName("SQLite - Delete")
|
|
class DeleteIT {
|
|
|
|
@Test
|
|
@DisplayName("byId deletes a matching ID")
|
|
fun byIdMatch() =
|
|
SQLiteDB().use(Delete::byIdMatch)
|
|
|
|
@Test
|
|
@DisplayName("byId succeeds when no ID matches")
|
|
fun byIdNoMatch() =
|
|
SQLiteDB().use(Delete::byIdNoMatch)
|
|
|
|
@Test
|
|
@DisplayName("byFields deletes matching documents")
|
|
fun byFieldsMatch() =
|
|
SQLiteDB().use(Delete::byFieldsMatch)
|
|
|
|
@Test
|
|
@DisplayName("byFields succeeds when no documents match")
|
|
fun byFieldsNoMatch() =
|
|
SQLiteDB().use(Delete::byFieldsNoMatch)
|
|
|
|
@Test
|
|
@DisplayName("byContains fails")
|
|
fun byContainsFails() {
|
|
assertThrows<DocumentException> { SQLiteDB().use(Delete::byContainsMatch) }
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("byJsonPath fails")
|
|
fun byJsonPathFails() {
|
|
assertThrows<DocumentException> { SQLiteDB().use(Delete::byJsonPathMatch) }
|
|
}
|
|
}
|