commit c1a218fa71a971c0d5317eb91b442bd4a2b88f06
parent 3496fcb010495b932dd60c99ffec55b170c31e00
Author: ms <ms@taler.net>
Date: Sat, 23 Oct 2021 08:41:13 +0200
fix test
Diffstat:
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/sandbox/src/test/kotlin/DBTest.kt b/sandbox/src/test/kotlin/DBTest.kt
@@ -22,7 +22,6 @@ import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.Test
import tech.libeufin.sandbox.*
import tech.libeufin.util.millis
-import tech.libeufin.util.parseDashedDate
import java.io.File
import java.time.LocalDateTime
@@ -97,16 +96,18 @@ class DBTest {
this.demobank = demobank
}
}
- val result = transaction {
+ // The block below tests the date range in the database query
+ transaction {
addLogger(StdOutSqlLogger)
BankAccountTransactionEntity.find {
BankAccountTransactionsTable.date.between(
- parseDashedDate("1970-01-01").toInstant().toEpochMilli(),
- LocalDateTime.now().millis()
+ 0, // 1970-01-01
+ LocalDateTime.now().millis() //
)
- }.firstOrNull()
+ }.apply {
+ assert(this.count() == 1L)
+ }
}
- assert(result != null)
}
}
}
\ No newline at end of file
diff --git a/util/src/main/kotlin/time.kt b/util/src/main/kotlin/time.kt
@@ -42,11 +42,6 @@ fun ZonedDateTime.toDashedDate(): String {
return DateTimeFormatter.ISO_DATE.format(this)
}
-fun parseDashedDate(date: String): ZonedDateTime {
- val dtf = DateTimeFormatter.ISO_DATE
- return ZonedDateTime.parse(date, dtf)
-}
-
fun importDateFromMillis(millis: Long): ZonedDateTime {
return ZonedDateTime.ofInstant(
Instant.ofEpochMilli(millis),