(t *testing.T)
| 530 | } |
| 531 | |
| 532 | func TestHandleUpdateTask_Title(t *testing.T) { |
| 533 | dir := createTestTaskDir(t) |
| 534 | dp := NewDataProvider(dir, false) |
| 535 | |
| 536 | body := strings.NewReader(`{"title":"New Title"}`) |
| 537 | req := httptest.NewRequest(http.MethodPut, "/api/tasks/001", body) |
| 538 | req.SetPathValue("id", "001") |
| 539 | rec := httptest.NewRecorder() |
| 540 | |
| 541 | handleUpdateTask(dp, false)(rec, req) |
| 542 | |
| 543 | if rec.Code != http.StatusOK { |
| 544 | t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String()) |
| 545 | } |
| 546 | |
| 547 | content, _ := os.ReadFile(filepath.Join(dir, "001-task-one.md")) |
| 548 | if !strings.Contains(string(content), `title: "New Title"`) { |
| 549 | t.Errorf("expected title update in file, got:\n%s", string(content)) |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | func TestHandleUpdateTask_Body(t *testing.T) { |
| 554 | dir := createTestTaskDir(t) |
nothing calls this directly
no test coverage detected