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

Function TestSet_OwnerUpdateExisting

apps/cli/internal/cli/set_test.go:251–287  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

249}
250
251func TestSet_OwnerUpdateExisting(t *testing.T) {
252 tmpDir := t.TempDir()
253
254 content := `---
255id: "020"
256title: "Task with owner"
257status: pending
258owner: alice
259created: 2026-02-08
260---
261
262# Task with owner
263`
264 path := filepath.Join(tmpDir, "020-owned.md")
265 if err := os.WriteFile(path, []byte(content), 0644); err != nil {
266 t.Fatalf("Failed to create test file: %v", err)
267 }
268
269 resetSetFlags()
270 taskDir = tmpDir
271 setTaskID = "020"
272 setOwner = "bob"
273
274 output, err := captureSetOutput(t)
275 if err != nil {
276 t.Fatalf("unexpected error: %v", err)
277 }
278
279 if !strings.Contains(output, "owner: alice -> bob") {
280 t.Errorf("Expected owner change in output, got: %s", output)
281 }
282
283 updated, _ := os.ReadFile(path)
284 if !strings.Contains(string(updated), "owner: bob") {
285 t.Errorf("Expected file to contain owner: bob, got:\n%s", string(updated))
286 }
287}
288
289func TestSet_DoneFlag(t *testing.T) {
290 tmpDir := createSetTestFiles(t)

Callers

nothing calls this directly

Calls 2

resetSetFlagsFunction · 0.85
captureSetOutputFunction · 0.85

Tested by

no test coverage detected