diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-07-17 22:46:18 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-07-17 22:46:18 +0000 |
| commit | be4d606e9a1f5b068abcc21bbac58d1e4705ea1f (patch) | |
| tree | 220aea277125aee4aa35a10201ab0a8a6c1caf89 /internal/handlers/chains_test.go | |
| parent | 9460b768335dcaf7f89020caf00f1a125de14b20 (diff) | |
Extend chain creation to accept per-task description and priority
CreateChain and POST /api/widget/chains previously only took bare
title strings, with priority hardcoded to 1 -- narrower than the
spec's "an ordered list of task titles/descriptions" API line. Now
accepts []models.ChainTaskInput{Content, Description, Priority} per
position, priority defaulting to 1 when omitted.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ7ikw2ukGJFTHE3bJS7zL
Diffstat (limited to 'internal/handlers/chains_test.go')
| -rw-r--r-- | internal/handlers/chains_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/handlers/chains_test.go b/internal/handlers/chains_test.go index 0ebcc7a..bf657d1 100644 --- a/internal/handlers/chains_test.go +++ b/internal/handlers/chains_test.go @@ -9,6 +9,8 @@ import ( "testing" "github.com/go-chi/chi/v5" + + "task-dashboard/internal/models" ) func withURLParam(req *http.Request, key, value string) *http.Request { @@ -22,7 +24,7 @@ func TestHandleWidgetChainsCreate_CreatesChain(t *testing.T) { defer cleanup() h := &Handler{store: db} - body := `{"name":"Ham Radio Track","tasks":["Study Technician","Pass exam"]}` + body := `{"name":"Ham Radio Track","tasks":[{"content":"Study Technician"},{"content":"Pass exam","description":"Pick a date","priority":3}]}` req := httptest.NewRequest("POST", "/api/widget/chains", strings.NewReader(body)) w := httptest.NewRecorder() h.HandleWidgetChainsCreate(w, req) @@ -67,7 +69,7 @@ func TestHandleWidgetChainGet_ReturnsChainAndTasks(t *testing.T) { defer cleanup() h := &Handler{store: db} - chain, err := h.store.CreateChain("Track", []string{"Step 1", "Step 2"}) + chain, err := h.store.CreateChain("Track", []models.ChainTaskInput{{Content: "Step 1"}, {Content: "Step 2"}}) if err != nil { t.Fatal(err) } @@ -107,7 +109,7 @@ func TestHandleWidgetChainsPauseResumeAbandon(t *testing.T) { defer cleanup() h := &Handler{store: db} - chain, err := h.store.CreateChain("Track", []string{"Step 1", "Step 2"}) + chain, err := h.store.CreateChain("Track", []models.ChainTaskInput{{Content: "Step 1"}, {Content: "Step 2"}}) if err != nil { t.Fatal(err) } |
