diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-27 06:19:31 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-27 06:19:31 +0200 |
| commit | 6b964400deb653d2c47aa8932ab5444346833b0d (patch) | |
| tree | fdb9166624b91fa11cfa1e9b4a2ca3ad63bf9739 /internal/askcli/command_delete_test.go | |
| parent | b67069c110c210b05507fca839d45b43431f5e86 (diff) | |
askcli: show task aliases in output (cd322ed1-882d-40e9-ab98-689acd5f161e)
Diffstat (limited to 'internal/askcli/command_delete_test.go')
| -rw-r--r-- | internal/askcli/command_delete_test.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/internal/askcli/command_delete_test.go b/internal/askcli/command_delete_test.go index ff3f435..7d049c6 100644 --- a/internal/askcli/command_delete_test.go +++ b/internal/askcli/command_delete_test.go @@ -11,6 +11,23 @@ import ( ) func TestHandleDelete_Success(t *testing.T) { + dir := t.TempDir() + oldRoot := taskAliasCacheRoot + oldNow := nowTaskAliasCache + taskAliasCacheRoot = func() (string, error) { return filepath.Join(dir, "hexai"), nil } + nowTaskAliasCache = func() time.Time { return time.Date(2026, 3, 26, 12, 0, 0, 0, time.UTC) } + defer func() { + taskAliasCacheRoot = oldRoot + nowTaskAliasCache = oldNow + }() + + writeTaskAliasCacheForTest(t, taskAliasCache{ + NextID: 1, + Entries: []taskAliasCacheEntry{ + {UUID: "test-uuid-123", Alias: "0", CreatedAt: nowTaskAliasCache()}, + }, + }) + d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid-123" && args[1] == "export" { io.WriteString(stdout, `[{"uuid":"test-uuid-123","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) @@ -26,8 +43,8 @@ func TestHandleDelete_Success(t *testing.T) { if err != nil { t.Fatalf("delete returned error: %v", err) } - if !strings.Contains(stdout.String(), "ok") || !strings.Contains(stdout.String(), "test-uuid-123") { - t.Fatalf("stdout = %q, want ok + uuid", stdout.String()) + if !strings.Contains(stdout.String(), "ok 0") || strings.Contains(stdout.String(), "test-uuid-123") { + t.Fatalf("stdout = %q, want ok + alias only", stdout.String()) } if stderr.Len() > 0 { t.Fatalf("stderr should be empty, got %q", stderr.String()) |
