summaryrefslogtreecommitdiff
path: root/internal/askcli/command_info_add_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-27 06:40:12 +0200
committerPaul Buetow <paul@buetow.org>2026-03-27 06:40:12 +0200
commit1f4c09e0f5a2a38c0b133264ec24e8ae5e5a3c22 (patch)
tree0dae145cc0d32b4a66f0f7e2035508d21c4fa2ec /internal/askcli/command_info_add_test.go
parent5e014f3a6c7fc766ed4216919f8b268d6e320d03 (diff)
test: cover ask info dependencies 052ad39a-6967-4628-a65c-db2a163de09b
Diffstat (limited to 'internal/askcli/command_info_add_test.go')
-rw-r--r--internal/askcli/command_info_add_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/internal/askcli/command_info_add_test.go b/internal/askcli/command_info_add_test.go
index a7a7bc2..bd95de4 100644
--- a/internal/askcli/command_info_add_test.go
+++ b/internal/askcli/command_info_add_test.go
@@ -60,6 +60,46 @@ func TestHandleInfo_Success(t *testing.T) {
}
}
+func TestHandleInfo_AssignsDependencyAliasesFromInfo(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", Alias: "0", CreatedAt: nowTaskAliasCache()},
+ },
+ })
+
+ jsonData := `[{"uuid":"test-uuid","description":"Test task","status":"pending","priority":"H","tags":["cli"],"urgency":15.0,"depends":["dep-b","dep-a"]}]`
+ d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) {
+ if len(args) > 0 && strings.HasPrefix(args[0], "uuid:") {
+ io.WriteString(stdout, jsonData)
+ }
+ return 0, nil
+ }})
+
+ var stdout, stderr bytes.Buffer
+ code, _ := d.Dispatch(context.Background(), []string{"info", "test-uuid"}, nil, &stdout, &stderr)
+ if code != 0 {
+ t.Fatalf("info code = %d, want 0", code)
+ }
+
+ output := stdout.String()
+ if !strings.Contains(output, "Depends:") ||
+ !strings.Contains(output, "(dep-a)") ||
+ !strings.Contains(output, "(dep-b)") {
+ t.Fatalf("output missing assigned dependency aliases: %s", output)
+ }
+}
+
func TestHandleInfo_AliasSelector(t *testing.T) {
dir := t.TempDir()
oldRoot := taskAliasCacheRoot