(t *testing.T)
| 551 | } |
| 552 | |
| 553 | func TestHandleUpdateTask_Body(t *testing.T) { |
| 554 | dir := createTestTaskDir(t) |
| 555 | dp := NewDataProvider(dir, false) |
| 556 | |
| 557 | body := strings.NewReader(`{"body":"# Updated\n\nNew body content."}`) |
| 558 | req := httptest.NewRequest(http.MethodPut, "/api/tasks/001", body) |
| 559 | req.SetPathValue("id", "001") |
| 560 | rec := httptest.NewRecorder() |
| 561 | |
| 562 | handleUpdateTask(dp, false)(rec, req) |
| 563 | |
| 564 | if rec.Code != http.StatusOK { |
| 565 | t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String()) |
| 566 | } |
| 567 | |
| 568 | content, _ := os.ReadFile(filepath.Join(dir, "001-task-one.md")) |
| 569 | s := string(content) |
| 570 | if !strings.Contains(s, "New body content.") { |
| 571 | t.Error("expected new body content in file") |
| 572 | } |
| 573 | if strings.Contains(s, "# Task One") { |
| 574 | t.Error("expected old body to be replaced") |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | func TestHandleUpdateTask_Tags(t *testing.T) { |
| 579 | dir := createTestTaskDir(t) |
nothing calls this directly
no test coverage detected