MCPcopy Create free account
hub / github.com/driangle/taskmd / TestGet_IDPrecedenceOverTitle

Function TestGet_IDPrecedenceOverTitle

apps/cli/internal/cli/get_test.go:146–186  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

144}
145
146func TestGet_IDPrecedenceOverTitle(t *testing.T) {
147 tmpDir := t.TempDir()
148
149 // Create a task whose title matches another task's ID
150 task1 := `---
151id: "abc"
152title: "First task"
153status: pending
154priority: low
155dependencies: []
156tags: []
157created: 2026-02-08
158---
159
160# First task
161`
162 task2 := `---
163id: "xyz"
164title: "abc"
165status: pending
166priority: high
167dependencies: []
168tags: []
169created: 2026-02-08
170---
171
172# abc task
173`
174 os.WriteFile(filepath.Join(tmpDir, "task1.md"), []byte(task1), 0644)
175 os.WriteFile(filepath.Join(tmpDir, "task2.md"), []byte(task2), 0644)
176
177 resetGetFlags()
178 taskDir = tmpDir
179
180 output := captureGetOutput(t, "abc")
181
182 // Should match by ID (task1), not by title (task2)
183 if !strings.Contains(output, "Title: First task") {
184 t.Error("Expected ID match to take precedence over title match")
185 }
186}
187
188func TestGet_TaskNotFound_ExactMode(t *testing.T) {
189 tmpDir := createGetTestFiles(t)

Callers

nothing calls this directly

Calls 3

resetGetFlagsFunction · 0.85
captureGetOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected