MCPcopy Index your code
hub / github.com/coder/coder / TestWatchChatDesktop

Function TestWatchChatDesktop

coderd/exp_chats_test.go:10510–10544  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10508}
10509
10510func 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

Callers

nothing calls this directly

Calls 9

ContextFunction · 0.92
CreateFirstUserFunction · 0.92
newChatClientFunction · 0.70
createChatModelConfigFunction · 0.70
RunMethod · 0.65
CreateChatMethod · 0.65
CloseMethod · 0.65
RequestMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected