MCPcopy Create free account
hub / github.com/compozy/agh / TestTaskBundlesRenderTaskRunAndDetailSections

Function TestTaskBundlesRenderTaskRunAndDetailSections

internal/cli/task_test.go:2639–2717  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2637}
2638
2639func TestTaskBundlesRenderTaskRunAndDetailSections(t *testing.T) {
2640 t.Parallel()
2641
2642 t.Run("Should render task detail toon sections", func(t *testing.T) {
2643 t.Parallel()
2644
2645 detail := sampleTaskDetailRecord()
2646 detailToon, err := taskDetailBundle(&detail).toon()
2647 if err != nil {
2648 t.Fatalf("taskDetailBundle().toon() error = %v", err)
2649 }
2650 if !strings.Contains(detailToon, "task_children[1]{id,identifier,scope,workspace_id,status,owner,title}:") ||
2651 !strings.Contains(detailToon, "task_dependencies[1]{task_id,depends_on_task_id,kind,created_at}:") ||
2652 !strings.Contains(
2653 detailToon,
2654 "task_runs[1]{id,status,attempt,session_id,claimed_by,network_channel,coordination_channel_id,queued_at,started_at,ended_at,error}:",
2655 ) ||
2656 !strings.Contains(detailToon, "task_events[1]{id,event_type,run_id,actor,origin,timestamp}:") {
2657 t.Fatalf("task detail toon output = %q, want child/dependency/run/event sections", detailToon)
2658 }
2659 })
2660
2661 t.Run("Should render task run human detail section", func(t *testing.T) {
2662 t.Parallel()
2663
2664 runHuman, err := taskRunBundle(sampleTaskRunRecord(taskpkg.TaskRunStatusCompleted)).human()
2665 if err != nil {
2666 t.Fatalf("taskRunBundle().human() error = %v", err)
2667 }
2668 if !strings.Contains(runHuman, "Task Run") || !strings.Contains(runHuman, "Idempotency Key") ||
2669 !strings.Contains(runHuman, "Result") {
2670 t.Fatalf("task run human output = %q, want task run detail section", runHuman)
2671 }
2672 })
2673
2674 t.Run("Should render task run detail human sections", func(t *testing.T) {
2675 t.Parallel()
2676
2677 detail := sampleTaskRunDetailRecord(taskpkg.TaskRunStatusRunning)
2678 detailHuman, err := taskRunDetailBundle(&detail).human()
2679 if err != nil {
2680 t.Fatalf("taskRunDetailBundle().human() error = %v", err)
2681 }
2682 if !strings.Contains(detailHuman, "Task Run") ||
2683 !strings.Contains(detailHuman, "Operational Summary") ||
2684 !strings.Contains(detailHuman, "Tool Calls") {
2685 t.Fatalf("task run detail human output = %q, want run/task/summary sections", detailHuman)
2686 }
2687 })
2688
2689 t.Run("Should render task run toon array", func(t *testing.T) {
2690 t.Parallel()
2691
2692 runToon, err := taskRunListBundle([]TaskRunRecord{sampleTaskRunRecord(taskpkg.TaskRunStatusCompleted)}).toon()
2693 if err != nil {
2694 t.Fatalf("taskRunListBundle().toon() error = %v", err)
2695 }
2696 if !strings.Contains(

Callers

nothing calls this directly

Calls 11

sampleTaskDetailRecordFunction · 0.85
taskDetailBundleFunction · 0.85
taskRunBundleFunction · 0.85
sampleTaskRunRecordFunction · 0.85
taskRunDetailBundleFunction · 0.85
taskRunListBundleFunction · 0.85
ContainsMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected