Workflow Handler Tests
(t *testing.T)
| 338 | // Workflow Handler Tests |
| 339 | |
| 340 | func TestWorkflowCreate(t *testing.T) { |
| 341 | srv, cleanup := setupTestServer(t) |
| 342 | defer cleanup() |
| 343 | |
| 344 | body := `{ |
| 345 | "name": "Test Workflow", |
| 346 | "description": "A test workflow", |
| 347 | "version": "1.0.0", |
| 348 | "steps": [ |
| 349 | { |
| 350 | "id": "step1", |
| 351 | "name": "First Step", |
| 352 | "type": "agent" |
| 353 | } |
| 354 | ] |
| 355 | }` |
| 356 | |
| 357 | req := httptest.NewRequest(http.MethodPost, "/v1/workflows", strings.NewReader(body)) |
| 358 | req.Header.Set("Content-Type", "application/json") |
| 359 | w := httptest.NewRecorder() |
| 360 | |
| 361 | srv.Router().ServeHTTP(w, req) |
| 362 | |
| 363 | assert.Equal(t, http.StatusCreated, w.Code) |
| 364 | assert.Contains(t, w.Body.String(), "success") |
| 365 | assert.Contains(t, w.Body.String(), "Test Workflow") |
| 366 | } |
| 367 | |
| 368 | func TestWorkflowList(t *testing.T) { |
| 369 | srv, cleanup := setupTestServer(t) |
nothing calls this directly
no test coverage detected