MCPcopy Create free account
hub / github.com/astercloud/aster / TestRoomCreate

Function TestRoomCreate

server/server_test.go:229–249  ·  view source on GitHub ↗

Room Handler Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

227// Room Handler Tests
228
229func 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
251func TestRoomGetNotFound(t *testing.T) {
252 srv, cleanup := setupTestServer(t)

Callers

nothing calls this directly

Calls 5

setupTestServerFunction · 0.85
SetMethod · 0.65
ServeHTTPMethod · 0.45
RouterMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected