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

Function TestGraphCommand_ASCII_Format

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

Source from the content-addressed store, hash-verified

241}
242
243func TestGraphCommand_ASCII_Format(t *testing.T) {
244 tmpDir := createTestTaskFiles(t)
245
246 // Reset flags
247 graphFormat = "ascii"
248 graphExcludeStatus = []string{}
249 graphAll = false
250 graphRoot = ""
251 graphFocus = ""
252 graphUpstream = false
253 graphDownstream = false
254 graphOut = ""
255
256 // Capture stdout
257 oldStdout := os.Stdout
258 r, w, _ := os.Pipe()
259 os.Stdout = w
260
261 // Run command
262 err := runGraph(graphCmd, []string{tmpDir})
263 if err != nil {
264 t.Fatalf("runGraph failed: %v", err)
265 }
266
267 // Restore stdout
268 w.Close()
269 os.Stdout = oldStdout
270
271 // Read output
272 var buf bytes.Buffer
273 buf.ReadFrom(r)
274 output := buf.String()
275
276 // Verify output contains task IDs
277 if !strings.Contains(output, "[001]") {
278 t.Error("Expected ASCII output to contain [001]")
279 }
280
281 if !strings.Contains(output, "[005]") {
282 t.Error("Expected ASCII output to contain [005]")
283 }
284
285 // Verify tree structure characters
286 if !strings.Contains(output, "└──") || !strings.Contains(output, "├──") {
287 t.Error("Expected ASCII output to contain tree structure characters")
288 }
289}
290
291func TestGraphCommand_ASCII_ExcludeCompleted(t *testing.T) {
292 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