summaryrefslogtreecommitdiff
path: root/internal/task/sort_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/task/sort_test.go')
-rw-r--r--internal/task/sort_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/task/sort_test.go b/internal/task/sort_test.go
index 10c1a12..056a389 100644
--- a/internal/task/sort_test.go
+++ b/internal/task/sort_test.go
@@ -26,3 +26,23 @@ func TestSortTasks(t *testing.T) {
t.Fatalf("unexpected order: %v", ids)
}
}
+
+func TestSortTasksStartedFirst(t *testing.T) {
+ tasks := []Task{
+ {ID: 1, Priority: "M", Start: "20240101T000000Z"},
+ {ID: 2, Priority: "H"},
+ {ID: 3, Priority: "H", Start: "20240102T000000Z"},
+ {ID: 4, Priority: "L"},
+ }
+
+ SortTasks(tasks)
+
+ var ids []int
+ for _, tsk := range tasks {
+ ids = append(ids, tsk.ID)
+ }
+ want := []int{3, 1, 2, 4}
+ if !reflect.DeepEqual(ids, want) {
+ t.Fatalf("unexpected order: %v", ids)
+ }
+}