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

Function TestGetUpstream

sdk/go/graph/graph_test.go:94–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestGetUpstream(t *testing.T) {
95 tasks := createTestTasks()
96 g := NewGraph(tasks)
97
98 // T5 depends on T3, T4, T2 (via T3, T4), T1 (via T2, T3)
99 upstream := g.GetUpstream("T5")
100
101 expectedUpstream := map[string]bool{
102 "T1": true,
103 "T2": true,
104 "T3": true,
105 "T4": true,
106 }
107
108 if len(upstream) != len(expectedUpstream) {
109 t.Errorf("Expected %d upstream tasks for T5, got %d", len(expectedUpstream), len(upstream))
110 }
111
112 for taskID := range expectedUpstream {
113 if !upstream[taskID] {
114 t.Errorf("Expected %s to be upstream of T5", taskID)
115 }
116 }
117}
118
119func TestDetectCycles(t *testing.T) {
120 // Create tasks with a cycle: T1 -> T2 -> T3 -> T1

Callers

nothing calls this directly

Calls 3

GetUpstreamMethod · 0.95
createTestTasksFunction · 0.85
NewGraphFunction · 0.85

Tested by

no test coverage detected