| 263 | } |
| 264 | |
| 265 | func TestToASCII(t *testing.T) { |
| 266 | tasks := []*model.Task{ |
| 267 | { |
| 268 | ID: "T1", |
| 269 | Title: "Task 1", |
| 270 | Status: model.StatusCompleted, |
| 271 | Dependencies: []string{}, |
| 272 | }, |
| 273 | { |
| 274 | ID: "T2", |
| 275 | Title: "Task 2", |
| 276 | Status: model.StatusInProgress, |
| 277 | Dependencies: []string{"T1"}, |
| 278 | }, |
| 279 | } |
| 280 | |
| 281 | g := NewGraph(tasks) |
| 282 | output := g.ToASCII("T1", true, nil) |
| 283 | |
| 284 | if !strings.Contains(output, "T1") { |
| 285 | t.Error("Expected ASCII output to contain T1") |
| 286 | } |
| 287 | |
| 288 | if !strings.Contains(output, "T2") { |
| 289 | t.Error("Expected ASCII output to contain T2") |
| 290 | } |
| 291 | |
| 292 | if !strings.Contains(output, "✓") { |
| 293 | t.Error("Expected ASCII output to contain completed checkmark") |
| 294 | } |
| 295 | |
| 296 | if !strings.Contains(output, "⋯") { |
| 297 | t.Error("Expected ASCII output to contain in-progress indicator") |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | func TestToJSON(t *testing.T) { |
| 302 | tasks := []*model.Task{ |