TestAPIExceptionDetailByEventID covers Fix B: the detail endpoint must resolve by event_id (the key the list and the frontend route use) and still return the populated exceptions/breadcrumbs keyed off the internal id.
(t *testing.T)
| 212 | // by event_id (the key the list and the frontend route use) and still return the |
| 213 | // populated exceptions/breadcrumbs keyed off the internal id. |
| 214 | func TestAPIExceptionDetailByEventID(t *testing.T) { |
| 215 | mux := http.NewServeMux() |
| 216 | seedTestData(t, mux) |
| 217 | |
| 218 | req := httptest.NewRequest("GET", "/api/sentry/exceptions", nil) |
| 219 | w := httptest.NewRecorder() |
| 220 | mux.ServeHTTP(w, req) |
| 221 | |
| 222 | var listResp map[string]any |
| 223 | json.Unmarshal(w.Body.Bytes(), &listResp) |
| 224 | first := listResp["data"].([]any)[0].(map[string]any) |
| 225 | eventID := first["event_id"].(string) |
| 226 | internalID := first["id"].(string) |
| 227 | |
| 228 | req = httptest.NewRequest("GET", "/api/sentry/exceptions/"+eventID, nil) |
| 229 | w = httptest.NewRecorder() |
| 230 | mux.ServeHTTP(w, req) |
| 231 | |
| 232 | if w.Code != 200 { |
| 233 | t.Fatalf("status = %d, want 200 for event_id lookup", w.Code) |
| 234 | } |
| 235 | |
| 236 | var detail map[string]any |
| 237 | json.Unmarshal(w.Body.Bytes(), &detail) |
| 238 | |
| 239 | if detail["id"] != internalID { |
| 240 | t.Errorf("detail id = %v, want internal id %q", detail["id"], internalID) |
| 241 | } |
| 242 | excs, ok := detail["exceptions"].([]any) |
| 243 | if !ok || len(excs) == 0 { |
| 244 | t.Errorf("exceptions empty for event_id lookup, want populated (got %v)", detail["exceptions"]) |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | func TestAPIExceptionDetailNotFound(t *testing.T) { |
| 249 | mux := http.NewServeMux() |
nothing calls this directly
no test coverage detected