(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func TestIsTaskBlocked(t *testing.T) { |
| 133 | tasks := []*model.Task{ |
| 134 | {ID: "001", Title: "Done", Status: model.StatusCompleted}, |
| 135 | {ID: "002", Title: "Pending", Status: model.StatusPending, Dependencies: []string{"001"}}, |
| 136 | {ID: "003", Title: "Blocked", Status: model.StatusPending, Dependencies: []string{"001", "999"}}, |
| 137 | {ID: "004", Title: "No deps", Status: model.StatusPending}, |
| 138 | } |
| 139 | taskMap := buildTaskMap(tasks) |
| 140 | |
| 141 | tests := []struct { |
| 142 | name string |
| 143 | taskID string |
| 144 | blocked bool |
| 145 | }{ |
| 146 | {"all deps completed but task pending", "002", true}, |
| 147 | {"missing dep", "003", true}, |
| 148 | {"no deps", "004", false}, |
| 149 | {"completed task with deps", "001", false}, |
| 150 | } |
| 151 | |
| 152 | for _, tt := range tests { |
| 153 | t.Run(tt.name, func(t *testing.T) { |
| 154 | task := taskMap[tt.taskID] |
| 155 | got := isTaskBlocked(task, taskMap) |
| 156 | if got != tt.blocked { |
| 157 | t.Errorf("isTaskBlocked(%s) = %v, want %v", tt.taskID, got, tt.blocked) |
| 158 | } |
| 159 | }) |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | func TestGroupSnapshots(t *testing.T) { |
| 164 | snapshots := []TaskSnapshot{ |
nothing calls this directly
no test coverage detected