test: prevとnextがnullになる場合のテストを追加

This commit is contained in:
usbharu 2024-01-30 22:59:13 +09:00
parent f80148815a
commit 2d6d25763e
1 changed files with 10 additions and 0 deletions

View File

@ -97,6 +97,16 @@ class ExposedPaginationExtensionKtTest {
assertThat(pagination).size().isEqualTo(30) assertThat(pagination).size().isEqualTo(30)
} }
@Test
fun 結果が0件の場合はprevとnextがnullになる():Unit = transaction {
val pagination = ExposePaginationTestTable.select { ExposePaginationTestTable.id.isNull() }
.withPagination(Page.of(), ExposePaginationTestTable.id)
assertThat(pagination).isEmpty()
assertThat(pagination.next).isNull()
assertThat(pagination.prev).isNull()
}
object ExposePaginationTestTable : Table(){ object ExposePaginationTestTable : Table(){
val id = long("id") val id = long("id")
val name = varchar("name",100) val name = varchar("name",100)