diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-26 22:28:52 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-26 22:28:52 +0200 |
| commit | c514262eb8bfd4042719efd28335f0e1ad9a4f48 (patch) | |
| tree | f6cea304240a88e41a99ab33280594858b28af8d /internal/askcli/dispatch_test.go | |
| parent | 5603667541240cc7eaf3b8cd2352bf12c1bdd8f2 (diff) | |
ask: speed up fish UUID completion
Diffstat (limited to 'internal/askcli/dispatch_test.go')
| -rw-r--r-- | internal/askcli/dispatch_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/askcli/dispatch_test.go b/internal/askcli/dispatch_test.go index 1586447..9a1bf43 100644 --- a/internal/askcli/dispatch_test.go +++ b/internal/askcli/dispatch_test.go @@ -46,6 +46,27 @@ func TestDispatcher_UnknownSubcommand(t *testing.T) { } } +func TestDispatcher_CompleteUUIDsSubcommand(t *testing.T) { + d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { + if strings.Join(args, " ") != "status:pending export" { + t.Fatalf("args = %v, want pending export", args) + } + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-1"}]`) + return 0, nil + }}) + var stdout, stderr bytes.Buffer + code, err := d.Dispatch(context.Background(), []string{"complete-uuids"}, nil, &stdout, &stderr) + if err != nil { + t.Fatalf("complete-uuids returned error: %v", err) + } + if code != 0 { + t.Fatalf("complete-uuids code = %d, want 0", code) + } + if got := stdout.String(); got != "uuid-1\n" { + t.Fatalf("stdout = %q, want UUID list", got) + } +} + func TestDispatcher_LongHelp(t *testing.T) { d := NewDispatcher(nil) var stdout bytes.Buffer |
