diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-20 19:25:01 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-20 19:25:01 -0500 |
| commit | 84251fc367e0d129dd77e951f587e2e2db0e98f6 (patch) | |
| tree | 4a23c5c246b96b8a99727304165c00433c372d5c /Omni/Task.hs | |
| parent | 0f3d43b40b39c8915303ee19901638197c33f1c6 (diff) | |
| parent | ada597842025a4dd083dcaf0f278b1123447c760 (diff) | |
Merge branch 'task/t-PpYZt2' into live
Diffstat (limited to 'Omni/Task.hs')
| -rw-r--r-- | Omni/Task.hs | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index d1e672a..24e528b 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -312,7 +312,47 @@ unitTests = ready <- getReadyTasks -- Both should be ready since Related doesn't block (taskId task1 `elem` map taskId ready) Test.@?= True - (taskId task2 `elem` map taskId ready) Test.@?= True + (taskId task2 `elem` map taskId ready) Test.@?= True, + Test.unit "child task gets sequential ID" <| do + parent <- createTask "Parent" Epic Nothing Nothing P2 [] + child1 <- createTask "Child 1" WorkTask (Just (taskId parent)) Nothing P2 [] + child2 <- createTask "Child 2" WorkTask (Just (taskId parent)) Nothing P2 [] + taskId child1 Test.@?= taskId parent <> ".1" + taskId child2 Test.@?= taskId parent <> ".2", + Test.unit "grandchild task gets sequential ID" <| do + parent <- createTask "Grandparent" Epic Nothing Nothing P2 [] + child <- createTask "Parent" Epic (Just (taskId parent)) Nothing P2 [] + grandchild <- createTask "Grandchild" WorkTask (Just (taskId child)) Nothing P2 [] + taskId grandchild Test.@?= taskId parent <> ".1.1", + Test.unit "siblings of grandchild task get sequential ID" <| do + parent <- createTask "Grandparent" Epic Nothing Nothing P2 [] + child <- createTask "Parent" Epic (Just (taskId parent)) Nothing P2 [] + grandchild1 <- createTask "Grandchild 1" WorkTask (Just (taskId child)) Nothing P2 [] + grandchild2 <- createTask "Grandchild 2" WorkTask (Just (taskId child)) Nothing P2 [] + taskId grandchild1 Test.@?= taskId parent <> ".1.1" + taskId grandchild2 Test.@?= taskId parent <> ".1.2", + Test.unit "child ID generation skips gaps" <| do + parent <- createTask "Parent with gaps" Epic Nothing Nothing P2 [] + child1 <- createTask "Child 1" WorkTask (Just (taskId parent)) Nothing P2 [] + -- Manually create a task with .3 suffix to simulate a gap (or deleted task) + let child3Id = taskId parent <> ".3" + child3 = Task + { taskId = child3Id, + taskTitle = "Child 3", + taskType = WorkTask, + taskParent = Just (taskId parent), + taskNamespace = Nothing, + taskStatus = Open, + taskPriority = P2, + taskDependencies = [], + taskCreatedAt = taskCreatedAt child1, + taskUpdatedAt = taskUpdatedAt child1 + } + saveTask child3 + + -- Create a new child, it should get .4, not .2 + child4 <- createTask "Child 4" WorkTask (Just (taskId parent)) Nothing P2 [] + taskId child4 Test.@?= taskId parent <> ".4" ] -- | Test CLI argument parsing to ensure docopt string matches actual usage |
