(t *testing.T)
| 10508 | } |
| 10509 | |
| 10510 | func TestWatchChatDesktop(t *testing.T) { |
| 10511 | t.Parallel() |
| 10512 | |
| 10513 | t.Run("NoWorkspace", func(t *testing.T) { |
| 10514 | t.Parallel() |
| 10515 | |
| 10516 | ctx := testutil.Context(t, testutil.WaitLong) |
| 10517 | client := newChatClient(t) |
| 10518 | firstUser := coderdtest.CreateFirstUser(t, client.Client) |
| 10519 | _ = createChatModelConfig(t, client) |
| 10520 | |
| 10521 | createdChat, err := client.CreateChat(ctx, codersdk.CreateChatRequest{ |
| 10522 | OrganizationID: firstUser.OrganizationID, |
| 10523 | Content: []codersdk.ChatInputPart{ |
| 10524 | { |
| 10525 | Type: codersdk.ChatInputPartTypeText, |
| 10526 | Text: "desktop no workspace test", |
| 10527 | }, |
| 10528 | }, |
| 10529 | }) |
| 10530 | require.NoError(t, err) |
| 10531 | |
| 10532 | // Try to connect to the desktop endpoint — should fail because |
| 10533 | // chat has no workspace. |
| 10534 | res, err := client.Request( |
| 10535 | ctx, |
| 10536 | http.MethodGet, |
| 10537 | fmt.Sprintf("/api/experimental/chats/%s/stream/desktop", createdChat.ID), |
| 10538 | nil, |
| 10539 | ) |
| 10540 | require.NoError(t, err) |
| 10541 | defer res.Body.Close() |
| 10542 | require.Equal(t, http.StatusBadRequest, res.StatusCode) |
| 10543 | }) |
| 10544 | } |
| 10545 | |
| 10546 | // TestWatchChatGitAuthz is the regression test for CODAGT-184. The |
| 10547 | // git-watcher handler opens a bidirectional websocket into the |
nothing calls this directly
no test coverage detected