(t *testing.T)
| 5004 | } |
| 5005 | |
| 5006 | func TestPatchChat(t *testing.T) { |
| 5007 | t.Parallel() |
| 5008 | |
| 5009 | createChat := func(ctx context.Context, t *testing.T, client *codersdk.ExperimentalClient, orgID uuid.UUID, text string) codersdk.Chat { |
| 5010 | t.Helper() |
| 5011 | |
| 5012 | chat, err := client.CreateChat(ctx, codersdk.CreateChatRequest{ |
| 5013 | OrganizationID: orgID, |
| 5014 | Content: []codersdk.ChatInputPart{ |
| 5015 | { |
| 5016 | Type: codersdk.ChatInputPartTypeText, |
| 5017 | Text: text, |
| 5018 | }, |
| 5019 | }, |
| 5020 | }) |
| 5021 | require.NoError(t, err) |
| 5022 | return chat |
| 5023 | } |
| 5024 | |
| 5025 | getChat := func(ctx context.Context, t *testing.T, client *codersdk.ExperimentalClient, chatID uuid.UUID) codersdk.Chat { |
| 5026 | t.Helper() |
| 5027 | |
| 5028 | chat, err := client.GetChat(ctx, chatID) |
| 5029 | require.NoError(t, err) |
| 5030 | return chat |
| 5031 | } |
| 5032 | |
| 5033 | createStoredChat := func( |
| 5034 | ctx context.Context, |
| 5035 | t *testing.T, |
| 5036 | db database.Store, |
| 5037 | ownerID uuid.UUID, |
| 5038 | orgID uuid.UUID, |
| 5039 | modelConfigID uuid.UUID, |
| 5040 | title string, |
| 5041 | ) codersdk.Chat { |
| 5042 | t.Helper() |
| 5043 | |
| 5044 | dbChat := dbgen.Chat(t, db, database.Chat{ |
| 5045 | OrganizationID: orgID, |
| 5046 | OwnerID: ownerID, |
| 5047 | LastModelConfigID: modelConfigID, |
| 5048 | Title: title, |
| 5049 | }) |
| 5050 | return db2sdk.Chat(dbChat, nil, nil) |
| 5051 | } |
| 5052 | |
| 5053 | t.Run("PlanMode", func(t *testing.T) { |
| 5054 | t.Parallel() |
| 5055 | |
| 5056 | t.Run("SetToPlan", func(t *testing.T) { |
| 5057 | t.Parallel() |
| 5058 | |
| 5059 | ctx := testutil.Context(t, testutil.WaitLong) |
| 5060 | mAudit := audit.NewMock() |
| 5061 | client := newChatClient(t, func(opts *coderdtest.Options) { |
| 5062 | opts.Auditor = mAudit |
| 5063 | }) |
nothing calls this directly
no test coverage detected