(t *testing.T)
| 173 | } |
| 174 | |
| 175 | func TestServer_UpdateSessionTitle(t *testing.T) { |
| 176 | t.Parallel() |
| 177 | |
| 178 | ctx := t.Context() |
| 179 | store := session.NewInMemorySessionStore() |
| 180 | lnPath := startServerWithStore(t, ctx, prepareAgentsDir(t), store) |
| 181 | |
| 182 | // Create a session first |
| 183 | createResp := httpDo(t, ctx, http.MethodPost, lnPath, "/api/sessions", map[string]any{}) |
| 184 | var createdSession session.Session |
| 185 | unmarshal(t, createResp, &createdSession) |
| 186 | require.NotEmpty(t, createdSession.ID) |
| 187 | |
| 188 | // Update the session title |
| 189 | newTitle := "My Custom Title" |
| 190 | updateResp := httpDo(t, ctx, http.MethodPatch, lnPath, "/api/sessions/"+createdSession.ID+"/title", api.UpdateSessionTitleRequest{Title: newTitle}) |
| 191 | var titleResp api.UpdateSessionTitleResponse |
| 192 | unmarshal(t, updateResp, &titleResp) |
| 193 | |
| 194 | assert.Equal(t, createdSession.ID, titleResp.ID) |
| 195 | assert.Equal(t, newTitle, titleResp.Title) |
| 196 | |
| 197 | // Verify the session was updated in the store |
| 198 | getResp := httpGET(t, ctx, lnPath, "/api/sessions/"+createdSession.ID) |
| 199 | var sessionResp api.SessionResponse |
| 200 | unmarshal(t, getResp, &sessionResp) |
| 201 | |
| 202 | assert.Equal(t, newTitle, sessionResp.Title) |
| 203 | } |
| 204 | |
| 205 | // TestServer_ForkSession exercises the POST /api/sessions/:id/fork |
| 206 | // endpoint end-to-end: a fork at the Nth user message must return a |
nothing calls this directly
no test coverage detected