diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-23 13:35:07 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-23 13:35:07 +0200 |
| commit | bc0849e96fe41e509af4306c0953f463a7fad155 (patch) | |
| tree | ca80dd932d177bdbe9eb80cb8bffe4197d50e625 /internal/askcli/command_list_test.go | |
| parent | 462184dff3eef32f01f06634305da1355ac1bec2 (diff) | |
fix: accept uuid: prefix on all ask subcommands via NormalizeUUID
All ask commands now strip a leading "uuid:" prefix from user-supplied
UUID arguments before building the taskwarrior filter, so both bare UUIDs
and the "uuid:<value>" format work uniformly across annotate, start, stop,
done, modify, denotate, priority, tag, info, delete, and dep.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/askcli/command_list_test.go')
| -rw-r--r-- | internal/askcli/command_list_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/askcli/command_list_test.go b/internal/askcli/command_list_test.go index e6bce83..903f397 100644 --- a/internal/askcli/command_list_test.go +++ b/internal/askcli/command_list_test.go @@ -68,6 +68,48 @@ func TestHandleList_EmptyList(t *testing.T) { } } +func TestHandleAll_Success(t *testing.T) { + jsonData := `[{"uuid":"uuid-1","description":"Done task","status":"completed","priority":"M","tags":[],"urgency":0.0,"depends":[]}]` + d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, jsonData) + return 0, nil + } + } + return 0, nil + }}) + var stdout, stderr bytes.Buffer + code, _ := d.Dispatch(context.Background(), []string{"all"}, nil, &stdout, &stderr) + if code != 0 { + t.Fatalf("all code = %d, want 0", code) + } + if !strings.Contains(stdout.String(), "uuid-1") { + t.Fatalf("output missing uuid-1: %s", stdout.String()) + } +} + +func TestHandleReady_Success(t *testing.T) { + jsonData := `[{"uuid":"uuid-ready","description":"Ready task","status":"pending","priority":"H","tags":["READY"],"urgency":20.0,"depends":[]}]` + d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { + for _, arg := range args { + if arg == "export" { + io.WriteString(stdout, jsonData) + return 0, nil + } + } + return 0, nil + }}) + var stdout, stderr bytes.Buffer + code, _ := d.Dispatch(context.Background(), []string{"ready"}, nil, &stdout, &stderr) + if code != 0 { + t.Fatalf("ready code = %d, want 0", code) + } + if !strings.Contains(stdout.String(), "uuid-ready") { + t.Fatalf("output missing uuid-ready: %s", stdout.String()) + } +} + func TestHandleList_PassesFilters(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { |
