| 177 | } |
| 178 | |
| 179 | func TestFeedback_AllCategories(t *testing.T) { |
| 180 | server, _, _ := setupAPI(t) |
| 181 | |
| 182 | for _, cat := range []string{"bug", "feature", "general"} { |
| 183 | t.Run(cat, func(t *testing.T) { |
| 184 | payload := fmt.Sprintf(`{"message":"test %s","category":"%s"}`, cat, cat) |
| 185 | resp, _ := http.Post(server.URL+"/api/feedback", "application/json", bytes.NewBufferString(payload)) |
| 186 | defer resp.Body.Close() |
| 187 | |
| 188 | if resp.StatusCode != 200 { |
| 189 | t.Errorf("status = %d, want 200 for category %s", resp.StatusCode, cat) |
| 190 | } |
| 191 | }) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | func TestFeedback_InvalidJSON(t *testing.T) { |
| 196 | server, _, _ := setupAPI(t) |