summaryrefslogtreecommitdiff
path: root/internal/worktime/entries_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-04 10:50:07 +0200
committerPaul Buetow <paul@buetow.org>2026-03-04 10:50:07 +0200
commit97aa8a6f666f5f40859c8a9aa4948bde435cf18f (patch)
tree0cb5928cd6a1220607dbf64e234a2522acac2848 /internal/worktime/entries_test.go
parentc25c9002f3214e07b041aefa26d5d13c26757839 (diff)
Rename project to timesamurai and release v0.5.0v0.5.0
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"