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

Function TestHandleUpdateTask_Title

apps/cli/internal/web/handlers_test.go:532–551  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

530}
531
532func 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
553func TestHandleUpdateTask_Body(t *testing.T) {
554 dir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 3

createTestTaskDirFunction · 0.85
NewDataProviderFunction · 0.85
handleUpdateTaskFunction · 0.85

Tested by

no test coverage detected