MCPcopy Create free account
hub / github.com/driangle/taskmd / TestGraphCommand_DOT_Format

Function TestGraphCommand_DOT_Format

apps/cli/internal/cli/graph_test.go:447–499  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

445}
446
447func 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
501func TestGraphCommand_RootDownstream(t *testing.T) {
502 tmpDir := createTestTaskFiles(t)

Callers

nothing calls this directly

Calls 3

runGraphFunction · 0.85
ErrorMethod · 0.80
createTestTaskFilesFunction · 0.70

Tested by

no test coverage detected