Room Handler Tests
(t *testing.T)
| 227 | // Room Handler Tests |
| 228 | |
| 229 | func TestRoomCreate(t *testing.T) { |
| 230 | srv, cleanup := setupTestServer(t) |
| 231 | defer cleanup() |
| 232 | |
| 233 | body := `{ |
| 234 | "name": "Test Room", |
| 235 | "metadata": { |
| 236 | "description": "A test room" |
| 237 | } |
| 238 | }` |
| 239 | |
| 240 | req := httptest.NewRequest(http.MethodPost, "/v1/rooms", strings.NewReader(body)) |
| 241 | req.Header.Set("Content-Type", "application/json") |
| 242 | w := httptest.NewRecorder() |
| 243 | |
| 244 | srv.Router().ServeHTTP(w, req) |
| 245 | |
| 246 | assert.Equal(t, http.StatusCreated, w.Code) |
| 247 | assert.Contains(t, w.Body.String(), "success") |
| 248 | assert.Contains(t, w.Body.String(), "Test Room") |
| 249 | } |
| 250 | |
| 251 | func TestRoomGetNotFound(t *testing.T) { |
| 252 | srv, cleanup := setupTestServer(t) |
nothing calls this directly
no test coverage detected