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

Function TestHandleBoard

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

Source from the content-addressed store, hash-verified

192}
193
194func TestHandleBoard(t *testing.T) {
195 dir := createTestTaskDir(t)
196 dp := NewDataProvider(dir, false)
197
198 req := httptest.NewRequest(http.MethodGet, "/api/board?groupBy=status", nil)
199 rec := httptest.NewRecorder()
200
201 handleBoard(dp, nil)(rec, req)
202
203 if rec.Code != http.StatusOK {
204 t.Fatalf("expected 200, got %d", rec.Code)
205 }
206
207 var groups []board.JSONGroup
208 if err := json.Unmarshal(rec.Body.Bytes(), &groups); err != nil {
209 t.Fatalf("invalid JSON: %v", err)
210 }
211
212 if len(groups) == 0 {
213 t.Fatal("expected at least one group")
214 }
215}
216
217func TestHandleBoardDefaultGroupBy(t *testing.T) {
218 dir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 3

createTestTaskDirFunction · 0.85
NewDataProviderFunction · 0.85
handleBoardFunction · 0.85

Tested by

no test coverage detected