(t *testing.T)
| 2595 | } |
| 2596 | |
| 2597 | func TestTaskCommandsSupportDetailAndToonOutput(t *testing.T) { |
| 2598 | t.Parallel() |
| 2599 | |
| 2600 | t.Run("Should render task detail human sections", func(t *testing.T) { |
| 2601 | t.Parallel() |
| 2602 | |
| 2603 | deps := newTestDeps(t, &stubClient{ |
| 2604 | getTaskFn: func(context.Context, string) (TaskDetailRecord, error) { |
| 2605 | return sampleTaskDetailRecord(), nil |
| 2606 | }, |
| 2607 | }) |
| 2608 | humanOut, _, err := executeRootCommand(t, deps, "task", "get", "task-1", "-o", "human") |
| 2609 | if err != nil { |
| 2610 | t.Fatalf("task get human error = %v", err) |
| 2611 | } |
| 2612 | if !strings.Contains(humanOut, "Task") || !strings.Contains(humanOut, "Dependencies") || |
| 2613 | !strings.Contains(humanOut, "Task Runs") { |
| 2614 | t.Fatalf("task get human output = %q, want detail sections", humanOut) |
| 2615 | } |
| 2616 | }) |
| 2617 | |
| 2618 | t.Run("Should render task list toon array", func(t *testing.T) { |
| 2619 | t.Parallel() |
| 2620 | |
| 2621 | deps := newTestDeps(t, &stubClient{ |
| 2622 | listTasksFn: func(context.Context, TaskListQuery) ([]TaskSummaryRecord, error) { |
| 2623 | return []TaskSummaryRecord{sampleTaskSummaryRecord()}, nil |
| 2624 | }, |
| 2625 | }) |
| 2626 | toonOut, _, err := executeRootCommand(t, deps, "task", "list", "-o", "toon") |
| 2627 | if err != nil { |
| 2628 | t.Fatalf("task list toon error = %v", err) |
| 2629 | } |
| 2630 | if !strings.Contains( |
| 2631 | toonOut, |
| 2632 | "tasks[1]{id,identifier,scope,workspace_id,parent_task_id,status,owner,network_channel,title}:", |
| 2633 | ) { |
| 2634 | t.Fatalf("task list toon output = %q, want tasks TOON array", toonOut) |
| 2635 | } |
| 2636 | }) |
| 2637 | } |
| 2638 | |
| 2639 | func TestTaskBundlesRenderTaskRunAndDetailSections(t *testing.T) { |
| 2640 | t.Parallel() |
nothing calls this directly
no test coverage detected