| 239 | } |
| 240 | |
| 241 | func TestFeedback_OptionalEmail(t *testing.T) { |
| 242 | server, _, _ := setupAPI(t) |
| 243 | |
| 244 | // No email field at all — should succeed |
| 245 | payload := `{"message":"anonymous feedback","category":"general"}` |
| 246 | resp, _ := http.Post(server.URL+"/api/feedback", "application/json", bytes.NewBufferString(payload)) |
| 247 | defer resp.Body.Close() |
| 248 | |
| 249 | if resp.StatusCode != 200 { |
| 250 | t.Errorf("status = %d, want 200 for feedback without email", resp.StatusCode) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | func TestFeedback_EmailTooLong(t *testing.T) { |
| 255 | server, _, _ := setupAPI(t) |