From b58787cfec0bd07abc316c66dc9be6c10b8113c6 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Wed, 25 Mar 2026 05:17:35 +0000 Subject: feat: add Claudomator stories as atom source in Doot tasks tab Co-Authored-By: Claude Sonnet 4.6 --- internal/api/claudomator_test.go | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 internal/api/claudomator_test.go (limited to 'internal/api/claudomator_test.go') diff --git a/internal/api/claudomator_test.go b/internal/api/claudomator_test.go new file mode 100644 index 0000000..4a2cb00 --- /dev/null +++ b/internal/api/claudomator_test.go @@ -0,0 +1,53 @@ +package api + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "testing" + + "task-dashboard/internal/models" +) + +func TestClaudomatorClient_GetActiveStories(t *testing.T) { + stories := []models.ClaudomatorStory{ + {ID: "1", Title: "Story One", Status: "IN_PROGRESS"}, + {ID: "2", Title: "Story Two", Status: "REVIEW_READY"}, + {ID: "3", Title: "Story Three", Status: "DRAFT"}, + } + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/api/stories" { + http.NotFound(w, r) + return + } + w.Header().Set("Content-Type", "application/json") + _ = json.NewEncoder(w).Encode(stories) + })) + defer server.Close() + + client := ClaudomatorHTTPClient{BaseURL: server.URL} + result, err := client.GetActiveStories(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + if len(result) != 2 { + t.Fatalf("expected 2 active stories, got %d", len(result)) + } + + statuses := map[string]bool{} + for _, s := range result { + statuses[s.Status] = true + } + if !statuses["IN_PROGRESS"] { + t.Error("expected IN_PROGRESS story in results") + } + if !statuses["REVIEW_READY"] { + t.Error("expected REVIEW_READY story in results") + } + if statuses["DRAFT"] { + t.Error("DRAFT story should be excluded from results") + } +} -- cgit v1.2.3