(t *testing.T)
| 264 | } |
| 265 | |
| 266 | func TestAPI_ListJobs(t *testing.T) { |
| 267 | srv := newTestServer() |
| 268 | |
| 269 | // Create a job first |
| 270 | body := `{"repo": "list/test"}` |
| 271 | req := httptest.NewRequest("POST", "/api/download", bytes.NewBufferString(body)) |
| 272 | req.Header.Set("Content-Type", "application/json") |
| 273 | w := httptest.NewRecorder() |
| 274 | srv.handleStartDownload(w, req) |
| 275 | |
| 276 | // List jobs |
| 277 | listReq := httptest.NewRequest("GET", "/api/jobs", nil) |
| 278 | listW := httptest.NewRecorder() |
| 279 | srv.handleListJobs(listW, listReq) |
| 280 | |
| 281 | if listW.Code != http.StatusOK { |
| 282 | t.Errorf("Expected 200, got %d", listW.Code) |
| 283 | } |
| 284 | |
| 285 | var resp map[string]any |
| 286 | json.Unmarshal(listW.Body.Bytes(), &resp) |
| 287 | |
| 288 | count := int(resp["count"].(float64)) |
| 289 | if count < 1 { |
| 290 | t.Error("Expected at least 1 job") |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | func TestAPI_ParseFiltersFromRepo(t *testing.T) { |
| 295 | srv := newTestServer() |
nothing calls this directly
no test coverage detected