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

Function TestStatus_ChildrenTree_JSON

apps/cli/internal/cli/status_test.go:391–422  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

389}
390
391func TestStatus_ChildrenTree_JSON(t *testing.T) {
392 tmpDir := createStatusTestFilesWithChildren(t)
393 resetStatusFlags()
394 taskDir = tmpDir
395 statusFormat = "json"
396
397 output := captureStatusOutput(t, "010")
398
399 var result statusOutput
400 if err := json.Unmarshal([]byte(output), &result); err != nil {
401 t.Fatalf("Failed to parse JSON: %v\nOutput: %s", err, output)
402 }
403
404 if len(result.Children) == 0 {
405 t.Fatal("Expected children in JSON output")
406 }
407
408 // Find child with grandchild
409 var foundGrandchild bool
410 for _, child := range result.Children {
411 if child.ID == "011" {
412 if len(child.Children) == 0 {
413 t.Error("Expected child 011 to have grandchild")
414 } else if child.Children[0].ID == "013" {
415 foundGrandchild = true
416 }
417 }
418 }
419 if !foundGrandchild {
420 t.Error("Expected to find grandchild 013 under child 011")
421 }
422}
423
424func TestStatus_ChildrenTree_Circular(t *testing.T) {
425 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 4

resetStatusFlagsFunction · 0.85
captureStatusOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected