Refactor scheduler and settings UI
This commit is contained in:
24
internal/scheduler/scheduler_test.go
Normal file
24
internal/scheduler/scheduler_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user