(t *testing.T)
| 389 | } |
| 390 | |
| 391 | func 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 | |
| 424 | func TestStatus_ChildrenTree_Circular(t *testing.T) { |
| 425 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected