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

Function TestIsTaskBlocked

apps/cli/internal/cli/snapshot_test.go:132–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func 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
163func TestGroupSnapshots(t *testing.T) {
164 snapshots := []TaskSnapshot{

Callers

nothing calls this directly

Calls 2

buildTaskMapFunction · 0.85
isTaskBlockedFunction · 0.85

Tested by

no test coverage detected