(t *testing.T)
| 111 | } |
| 112 | |
| 113 | func TestAPIExceptionsGrouped(t *testing.T) { |
| 114 | mux := http.NewServeMux() |
| 115 | seedTestData(t, mux) |
| 116 | |
| 117 | req := httptest.NewRequest("GET", "/api/sentry/exceptions?grouped=true", nil) |
| 118 | w := httptest.NewRecorder() |
| 119 | mux.ServeHTTP(w, req) |
| 120 | |
| 121 | if w.Code != 200 { |
| 122 | t.Fatalf("status = %d, want 200", w.Code) |
| 123 | } |
| 124 | |
| 125 | var resp map[string]any |
| 126 | json.Unmarshal(w.Body.Bytes(), &resp) |
| 127 | |
| 128 | data := resp["data"].([]any) |
| 129 | if len(data) != 2 { |
| 130 | t.Fatalf("data length = %d, want 2 (2 distinct fingerprints)", len(data)) |
| 131 | } |
| 132 | |
| 133 | // First group should have count 2 (RuntimeException). |
| 134 | first := data[0].(map[string]any) |
| 135 | if int(first["count"].(float64)) != 2 { |
| 136 | t.Errorf("first group count = %v, want 2", first["count"]) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | func TestAPIExceptionsFilterLevel(t *testing.T) { |
| 141 | mux := http.NewServeMux() |
nothing calls this directly
no test coverage detected