summaryrefslogtreecommitdiff
path: root/internal/task/sort_test.go
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 21:35:01 +0300
committerPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-20 21:35:01 +0300
commit66e614304abec6132c88c3fe84f99dd9f960c90f (patch)
treeca6423fd4e139cb8f7c7509fb93961e93fc4d58f /internal/task/sort_test.go
parentfe915c0c6eb7612bf645f55a99ac218df0e73ae8 (diff)
sort: prioritize started tasks
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)
+ }
+}