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:36 +0300
committerGitHub <noreply@github.com>2025-06-20 21:35:36 +0300
commitf857a5fc9790b3841ab3f43020f755021a4c0003 (patch)
tree0264f1199fbc0f08c927634f5f1d6b42db665d5c /internal/task/sort_test.go
parent62842fe088e54f3a034c9ee4166ac684b6bb38a7 (diff)
parent66e614304abec6132c88c3fe84f99dd9f960c90f (diff)
Merge pull request #49 from snonux/codex/add--started--tasks-to-sorting-order
Prioritize started tasks in sorting
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)
+ }
+}