summaryrefslogtreecommitdiff
path: root/internal/worktime/entries_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/worktime/entries_test.go')
-rw-r--r--internal/worktime/entries_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/worktime/entries_test.go b/internal/worktime/entries_test.go
index 3b3296e..0a605f9 100644
--- a/internal/worktime/entries_test.go
+++ b/internal/worktime/entries_test.go
@@ -115,6 +115,28 @@ func TestAddSubAndUseBuffer(t *testing.T) {
}
}
+func TestAddDayOff(t *testing.T) {
+ dbDir := t.TempDir()
+ host := "host-a"
+
+ day := time.Date(2026, time.January, 12, 16, 30, 0, 0, time.Local)
+ entry, err := AddDayOff(dbDir, host, day, "vacation")
+ if err != nil {
+ t.Fatalf("AddDayOff() error = %v", err)
+ }
+
+ wantDayStart := time.Date(2026, time.January, 12, 0, 0, 0, 0, time.Local)
+ if entry.What != "off" {
+ t.Fatalf("entry.What = %q, want off", entry.What)
+ }
+ if entry.Value != 8*3600 {
+ t.Fatalf("entry.Value = %d, want 28800", entry.Value)
+ }
+ if entry.Epoch != wantDayStart.Unix() {
+ t.Fatalf("entry.Epoch = %d, want %d", entry.Epoch, wantDayStart.Unix())
+ }
+}
+
func TestDurationValidation(t *testing.T) {
dbDir := t.TempDir()
host := "host-a"