(t *testing.T)
| 445 | } |
| 446 | |
| 447 | func TestGraphCommand_DOT_Format(t *testing.T) { |
| 448 | tmpDir := createTestTaskFiles(t) |
| 449 | |
| 450 | // Reset flags |
| 451 | graphFormat = "dot" |
| 452 | graphExcludeStatus = []string{} |
| 453 | graphAll = false |
| 454 | graphRoot = "" |
| 455 | graphFocus = "" |
| 456 | graphUpstream = false |
| 457 | graphDownstream = false |
| 458 | graphOut = "" |
| 459 | |
| 460 | // Capture stdout |
| 461 | oldStdout := os.Stdout |
| 462 | r, w, _ := os.Pipe() |
| 463 | os.Stdout = w |
| 464 | |
| 465 | // Run command |
| 466 | err := runGraph(graphCmd, []string{tmpDir}) |
| 467 | if err != nil { |
| 468 | t.Fatalf("runGraph failed: %v", err) |
| 469 | } |
| 470 | |
| 471 | // Restore stdout |
| 472 | w.Close() |
| 473 | os.Stdout = oldStdout |
| 474 | |
| 475 | // Read output |
| 476 | var buf bytes.Buffer |
| 477 | buf.ReadFrom(r) |
| 478 | output := buf.String() |
| 479 | |
| 480 | // Verify DOT syntax |
| 481 | if !strings.Contains(output, "digraph tasks") { |
| 482 | t.Error("Expected DOT output to start with 'digraph tasks'") |
| 483 | } |
| 484 | |
| 485 | // Verify nodes are defined |
| 486 | if !strings.Contains(output, "001 [label=") { |
| 487 | t.Error("Expected node definition for task 001") |
| 488 | } |
| 489 | |
| 490 | // Verify edges |
| 491 | if !strings.Contains(output, "->") { |
| 492 | t.Error("Expected DOT output to contain edge arrows") |
| 493 | } |
| 494 | |
| 495 | // Verify colors are applied |
| 496 | if !strings.Contains(output, "fillcolor=") { |
| 497 | t.Error("Expected DOT output to contain color definitions") |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | func TestGraphCommand_RootDownstream(t *testing.T) { |
| 502 | tmpDir := createTestTaskFiles(t) |
nothing calls this directly
no test coverage detected