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

Function TestTaskRunCommandsMapLifecycleRequests

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

Source from the content-addressed store, hash-verified

770}
771
772func TestTaskRunCommandsMapLifecycleRequests(t *testing.T) {
773 t.Parallel()
774
775 tests := []struct {
776 name string
777 run func(t *testing.T)
778 }{
779 {
780 name: "Should parse task run list filters",
781 run: func(t *testing.T) {
782 t.Helper()
783
784 var runListQuery TaskRunListQuery
785 deps := newTestDeps(t, &stubClient{
786 listTaskRunsFn: func(_ context.Context, _ string, query TaskRunListQuery) ([]TaskRunRecord, error) {
787 runListQuery = query
788 return []TaskRunRecord{sampleTaskRunRecord(taskpkg.TaskRunStatusRunning)}, nil
789 },
790 })
791
792 if _, _, err := executeRootCommand(
793 t,
794 deps,
795 "task",
796 "run",
797 "list",
798 "task-1",
799 "--status",
800 "running",
801 "--session",
802 "sess-1",
803 "--last",
804 "2",
805 "-o",
806 "json",
807 ); err != nil {
808 t.Fatalf("task run list error = %v", err)
809 }
810 if runListQuery.Status != taskpkg.TaskRunStatusRunning || runListQuery.SessionID != "sess-1" ||
811 runListQuery.Limit != 2 {
812 t.Fatalf("runListQuery = %#v, want parsed run filters", runListQuery)
813 }
814 },
815 },
816 {
817 name: "Should show task run",
818 run: func(t *testing.T) {
819 t.Helper()
820
821 var gotID string
822 deps := newTestDeps(t, &stubClient{
823 getTaskRunFn: func(_ context.Context, id string) (TaskRunDetailRecord, error) {
824 gotID = id
825 return sampleTaskRunDetailRecord(taskpkg.TaskRunStatusQueued), nil
826 },
827 })
828
829 stdout, _, err := executeRootCommand(t, deps, "task", "run", "show", "run-1", "-o", "json")

Callers

nothing calls this directly

Calls 6

newTestDepsFunction · 0.85
sampleTaskRunRecordFunction · 0.85
executeRootCommandFunction · 0.85
RunMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected