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

Function makeAITask

cli/task_list_test.go:28–57  ·  view source on GitHub ↗

makeAITask creates an AI-task workspace.

(t *testing.T, db database.Store, orgID, adminID, ownerID uuid.UUID, transition database.WorkspaceTransition, prompt string)

Source from the content-addressed store, hash-verified

26
27// makeAITask creates an AI-task workspace.
28func makeAITask(t *testing.T, db database.Store, orgID, adminID, ownerID uuid.UUID, transition database.WorkspaceTransition, prompt string) database.Task {
29 t.Helper()
30
31 tv := dbfake.TemplateVersion(t, db).
32 Seed(database.TemplateVersion{
33 OrganizationID: orgID,
34 CreatedBy: adminID,
35 HasAITask: sql.NullBool{
36 Bool: true,
37 Valid: true,
38 },
39 }).Do()
40
41 build := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
42 OrganizationID: orgID,
43 OwnerID: ownerID,
44 TemplateID: tv.Template.ID,
45 }).
46 Seed(database.WorkspaceBuild{
47 TemplateVersionID: tv.TemplateVersion.ID,
48 Transition: transition,
49 }).
50 WithAgent().
51 WithTask(database.TaskTable{
52 Prompt: prompt,
53 }, nil).
54 Do()
55
56 return build.Task
57}
58
59func TestExpTaskList(t *testing.T) {
60 t.Parallel()

Callers 2

TestExpTaskListFunction · 0.85

Calls 7

TemplateVersionFunction · 0.92
WorkspaceBuildFunction · 0.92
WithTaskMethod · 0.80
WithAgentMethod · 0.80
HelperMethod · 0.65
DoMethod · 0.65
SeedMethod · 0.45

Tested by

no test coverage detected