Add configurable timestamp date and clock formats
This commit is contained in:
@@ -7,6 +7,9 @@ import org.junit.Test
|
||||
import se.ajpanton.notificationlog.model.NotificationAction
|
||||
import se.ajpanton.notificationlog.model.NotificationLogEntry
|
||||
import se.ajpanton.notificationlog.settings.LogViewSettings
|
||||
import se.ajpanton.notificationlog.settings.TimestampClockFormat
|
||||
import se.ajpanton.notificationlog.settings.TimestampDateFormat
|
||||
import se.ajpanton.notificationlog.settings.TimestampZone
|
||||
|
||||
class LogExporterTest {
|
||||
private val imageEntry = NotificationLogEntry(
|
||||
@@ -51,4 +54,14 @@ class LogExporterTest {
|
||||
assertEquals(LogExporter.formatted(listOf(imageEntry), settings), formatted)
|
||||
assertEquals(LogExporter.html(listOf(imageEntry), settings) { "images/${it.imageId}.png" }, html)
|
||||
}
|
||||
|
||||
@Test fun `exports use the configured timestamp date and clock formats`() {
|
||||
val settings = LogViewSettings(
|
||||
timestampZone = TimestampZone.UTC,
|
||||
timestampDateFormat = TimestampDateFormat.YEAR_MONTH_DAY,
|
||||
timestampClockFormat = TimestampClockFormat.HOUR_24,
|
||||
)
|
||||
|
||||
assertTrue(LogExporter.csv(listOf(imageEntry), settings).contains("1970-01-01 00:00:00"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user