diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-27 06:51:24 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-27 06:51:24 +0200 |
| commit | f19a4740992f3fd5f6d2f8b13850c9eb637f6a76 (patch) | |
| tree | 5296cf52515636ebb43987fd87564ff2f99e6d2b /internal/askcli/command_dep_test.go | |
| parent | 426b836d03078a5e438319d0d2a90d9d2a93430b (diff) | |
fix ask alias output wording 7f53c2ff-4eb0-4c7e-bf90-f44587364f4a
Diffstat (limited to 'internal/askcli/command_dep_test.go')
| -rw-r--r-- | internal/askcli/command_dep_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/askcli/command_dep_test.go b/internal/askcli/command_dep_test.go index f674d28..93e5175 100644 --- a/internal/askcli/command_dep_test.go +++ b/internal/askcli/command_dep_test.go @@ -123,6 +123,31 @@ func TestHandleDep_ListSuccess(t *testing.T) { } } +func TestHandleDep_ListAssignsAliasForUnknownDependency(t *testing.T) { + now := useIsolatedTaskAliasCache(t) + + writeTaskAliasCacheForTest(t, taskAliasCache{ + NextID: 1, + Entries: []taskAliasCacheEntry{ + {UUID: "uuid-1", Alias: "0", CreatedAt: now}, + }, + }) + + jsonData := `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":["dep-1"]}]` + d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { + io.WriteString(stdout, jsonData) + return 0, nil + }}) + var stdout, stderr bytes.Buffer + code, _ := d.Dispatch(context.Background(), []string{"dep", "list", "uuid-1"}, nil, &stdout, &stderr) + if code != 0 { + t.Fatalf("dep list code = %d, want 0", code) + } + if got := stdout.String(); got != "1\n" { + t.Fatalf("stdout = %q, want assigned alias", got) + } +} + func TestHandleDep_UnknownOp(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { return 0, nil @@ -224,4 +249,7 @@ func TestHandleDep_NumericUUID(t *testing.T) { if code != 1 { t.Fatalf("dep add code = %d, want 1 for numeric UUID", code) } + if !strings.Contains(stderr.String(), "task alias ID or UUID") { + t.Fatalf("stderr = %q, want alias-or-UUID guidance", stderr.String()) + } } |
