(t *testing.T)
| 438 | } |
| 439 | |
| 440 | func TestAPIEmptyDatabase(t *testing.T) { |
| 441 | db := setupTestDB(t) |
| 442 | mux := http.NewServeMux() |
| 443 | registerAPI(mux, db) |
| 444 | |
| 445 | endpoints := []string{ |
| 446 | "/api/sentry/exceptions", |
| 447 | "/api/sentry/exceptions?grouped=true", |
| 448 | "/api/sentry/traces", |
| 449 | "/api/sentry/logs", |
| 450 | "/api/sentry/service-map", |
| 451 | "/api/sentry/counts", |
| 452 | } |
| 453 | |
| 454 | for _, ep := range endpoints { |
| 455 | t.Run(ep, func(t *testing.T) { |
| 456 | req := httptest.NewRequest("GET", ep, nil) |
| 457 | w := httptest.NewRecorder() |
| 458 | mux.ServeHTTP(w, req) |
| 459 | |
| 460 | if w.Code != 200 { |
| 461 | t.Fatalf("status = %d, want 200 for %s", w.Code, ep) |
| 462 | } |
| 463 | }) |
| 464 | } |
| 465 | } |
nothing calls this directly
no test coverage detected