Refactor scheduler and settings UI

This commit is contained in:
Mikhail Chusavitin
2026-03-07 21:10:20 +03:00
parent 27e33db446
commit b2b2f4774c
23 changed files with 1601 additions and 551 deletions

View File

@@ -0,0 +1,24 @@
package scheduler
import (
"testing"
"time"
)
func TestJobDue(t *testing.T) {
now := time.Date(2026, 3, 7, 12, 0, 0, 0, time.UTC)
if !jobDue(nil, now, time.Hour) {
t.Fatalf("expected nil lastFinishedAt to be due")
}
lastFinished := now.Add(-59 * time.Minute)
if jobDue(&lastFinished, now, time.Hour) {
t.Fatalf("expected job not to be due before interval elapsed")
}
lastFinished = now.Add(-1 * time.Hour)
if !jobDue(&lastFinished, now, time.Hour) {
t.Fatalf("expected job to be due at interval boundary")
}
}