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

Function insertLinkedChatFile

coderd/x/chatd/subagent_internal_test.go:3101–3132  ·  view source on GitHub ↗
(
	ctx context.Context,
	t *testing.T,
	db database.Store,
	chatID uuid.UUID,
	ownerID uuid.UUID,
	organizationID uuid.UUID,
	name string,
	mediaType string,
	data []byte,
)

Source from the content-addressed store, hash-verified

3099}
3100
3101func insertLinkedChatFile(
3102 ctx context.Context,
3103 t *testing.T,
3104 db database.Store,
3105 chatID uuid.UUID,
3106 ownerID uuid.UUID,
3107 organizationID uuid.UUID,
3108 name string,
3109 mediaType string,
3110 data []byte,
3111) uuid.UUID {
3112 t.Helper()
3113
3114 file, err := db.InsertChatFile(ctx, database.InsertChatFileParams{
3115 OwnerID: ownerID,
3116 OrganizationID: organizationID,
3117 Name: name,
3118 Mimetype: mediaType,
3119 Data: data,
3120 })
3121 require.NoError(t, err)
3122
3123 rejected, err := db.LinkChatFiles(ctx, database.LinkChatFilesParams{
3124 ChatID: chatID,
3125 MaxFileLinks: int32(codersdk.MaxChatFileIDs),
3126 FileIds: []uuid.UUID{file.ID},
3127 })
3128 require.NoError(t, err)
3129 require.Zero(t, rejected)
3130
3131 return file.ID
3132}
3133
3134func TestWaitAgentDoesNotRelayComputerUseSubagentAttachments(t *testing.T) {
3135 t.Parallel()

Calls 3

HelperMethod · 0.65
InsertChatFileMethod · 0.65
LinkChatFilesMethod · 0.65

Tested by

no test coverage detected