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

Function TestChat_MultipleFiles

coderd/database/db2sdk/db2sdk_test.go:1159–1199  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1157}
1158
1159func TestChat_MultipleFiles(t *testing.T) {
1160 t.Parallel()
1161
1162 now := dbtime.Now()
1163 file1 := uuid.New()
1164 file2 := uuid.New()
1165
1166 chat := database.Chat{
1167 ID: uuid.New(),
1168 OwnerID: uuid.New(),
1169 LastModelConfigID: uuid.New(),
1170 Title: "multi file test",
1171 Status: database.ChatStatusWaiting,
1172 CreatedAt: now,
1173 UpdatedAt: now,
1174 }
1175
1176 rows := []database.GetChatFileMetadataByChatIDRow{
1177 {
1178 ID: file1,
1179 OwnerID: chat.OwnerID,
1180 OrganizationID: uuid.New(),
1181 Name: "a.png",
1182 Mimetype: "image/png",
1183 CreatedAt: now,
1184 },
1185 {
1186 ID: file2,
1187 OwnerID: chat.OwnerID,
1188 OrganizationID: uuid.New(),
1189 Name: "b.txt",
1190 Mimetype: "text/plain",
1191 CreatedAt: now,
1192 },
1193 }
1194
1195 result := db2sdk.Chat(chat, nil, rows)
1196 require.Len(t, result.Files, 2)
1197 require.Equal(t, "a.png", result.Files[0].Name)
1198 require.Equal(t, "b.txt", result.Files[1].Name)
1199}
1200
1201func TestChatQueuedMessage_MalformedContent(t *testing.T) {
1202 t.Parallel()

Callers

nothing calls this directly

Calls 5

NowFunction · 0.92
ChatFunction · 0.92
NewMethod · 0.65
LenMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected