diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-22 22:26:19 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-22 22:26:19 +0200 |
| commit | a0f7ee1cd4b0833ff45b94e2a35c60227e6ec1e3 (patch) | |
| tree | cf85a206d88431dc88c6d882d07ff2a9fb70f331 /internal/askcli/command_list_test.go | |
| parent | f6ce62d4e5cefc4a7761bbb86f329ad08ba57570 (diff) | |
ask list: only show pending tasks by defaultv0.25.3
Add status:pending filter to list command so it only shows pending
tasks, not completed or deleted ones. Use 'ask all' to see all tasks.
Diffstat (limited to 'internal/askcli/command_list_test.go')
| -rw-r--r-- | internal/askcli/command_list_test.go | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/internal/askcli/command_list_test.go b/internal/askcli/command_list_test.go index 745a402..e6bce83 100644 --- a/internal/askcli/command_list_test.go +++ b/internal/askcli/command_list_test.go @@ -11,8 +11,11 @@ import ( func TestHandleList_Success(t *testing.T) { jsonData := `[{"uuid":"uuid-1","description":"Task 1","status":"pending","priority":"H","tags":["cli"],"urgency":15.0,"depends":[]},{"uuid":"uuid-2","description":"Task 2","status":"completed","priority":"M","tags":["agent"],"urgency":10.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "export" { - io.WriteString(stdout, jsonData) + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, jsonData) + return 0, nil + } } return 0, nil }}) @@ -30,8 +33,11 @@ func TestHandleList_Success(t *testing.T) { func TestHandleList_SortedByPriority(t *testing.T) { jsonData := `[{"uuid":"uuid-2","description":"Task 2","status":"pending","priority":"M","tags":[],"urgency":10.0,"depends":[]},{"uuid":"uuid-1","description":"Task 1","status":"pending","priority":"H","tags":[],"urgency":5.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "export" { - io.WriteString(stdout, jsonData) + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, jsonData) + return 0, nil + } } return 0, nil }}) @@ -47,8 +53,11 @@ func TestHandleList_SortedByPriority(t *testing.T) { func TestHandleList_EmptyList(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - if args[0] == "export" { - io.WriteString(stdout, "[]") + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, "[]") + return 0, nil + } } return 0, nil }}) @@ -71,7 +80,14 @@ func TestHandleList_PassesFilters(t *testing.T) { if len(capturedArgs) < 2 { t.Fatalf("expected export args, got %v", capturedArgs) } - if capturedArgs[0] != "export" { - t.Fatalf("first arg should be export, got %s", capturedArgs[0]) + hasExport := false + for _, arg := range capturedArgs { + if arg == "export" { + hasExport = true + break + } + } + if !hasExport { + t.Fatalf("expected export in args, got %v", capturedArgs) } } |
