Skip to content

Commit

Permalink
Add PostgreSql Integration test for min max timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
griffio committed Jun 10, 2023
1 parent 496087d commit 09b90c9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ SELECT NOW();

selectInterval:
SELECT INTERVAL '1 day';

selectMax:
SELECT max(timestamp) FROM dates;

selectMin:
SELECT min(timestamp_with_timezone) FROM dates;
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,23 @@ class PostgreSqlTest {
)
}

@Test fun testMinMaxTimeStamps() {
database.datesQueries.insertDate(
date = LocalDate.of(2022, 1, 1),
time = LocalTime.of(11, 30, 59, 10000),
timestamp = LocalDateTime.of(2029, 1, 1, 21, 30, 59, 10000),
timestamp_with_timezone = OffsetDateTime.of(1970, 4, 9, 20, 15, 45, 0, ZoneOffset.ofHours(0)),
).executeAsOne()

database.datesQueries.selectMax().executeAsOne().let {
assertThat(it.max).isEqualTo(LocalDateTime.of(2029, 1, 1, 21, 30, 59, 10000))
}

database.datesQueries.selectMin().executeAsOne().let {
assertThat(it.min).isEqualTo(OffsetDateTime.of(1970, 4, 9, 20, 15, 45, 0, ZoneOffset.ofHours(0)))
}
}

@Test fun testSerial() {
database.run {
oneEntityQueries.transaction {
Expand Down

0 comments on commit 09b90c9

Please sign in to comment.