MCPcopy
hub / github.com/coder/mux / createBestOfTaskServiceTestHarness

Function createBestOfTaskServiceTestHarness

src/node/services/taskService.test.ts:11518–11558  ·  view source on GitHub ↗
(params: {
    parentId: string;
    children: readonly BestOfTestChildWorkspace[];
  })

Source from the content-addressed store, hash-verified

11516 }
11517
11518 async function createBestOfTaskServiceTestHarness(params: {
11519 parentId: string;
11520 children: readonly BestOfTestChildWorkspace[];
11521 }) {
11522 const config = await createTestConfig(rootDir);
11523 const projectPath = path.join(rootDir, "repo");
11524
11525 await saveWorkspaces(
11526 config,
11527 projectPath,
11528 [
11529 projectWorkspace(projectPath, "parent", params.parentId),
11530 ...params.children.map((child) => ({
11531 path: path.join(projectPath, child.pathName ?? child.id),
11532 id: child.id,
11533 name: child.name,
11534 ...(child.title ? { title: child.title } : {}),
11535 parentWorkspaceId: params.parentId,
11536 agentType: child.agentType ?? "explore",
11537 ...(child.agentId ? { agentId: child.agentId } : {}),
11538 taskStatus: child.taskStatus,
11539 ...(child.createdAt ? { createdAt: child.createdAt } : {}),
11540 bestOf: child.bestOf,
11541 })),
11542 ],
11543 testTaskSettings()
11544 );
11545
11546 const { aiService } = createAIServiceMocks(config);
11547 const remove = mock(async (workspaceId: string, _force?: boolean): Promise<Result<void>> => {
11548 await removeWorkspaceFromTestConfig(config, workspaceId);
11549 return Ok(undefined);
11550 });
11551 const { workspaceService } = createWorkspaceServiceMocks({ remove });
11552
11553 return {
11554 config,
11555 remove,
11556 ...createTaskServiceHarness(config, { aiService, workspaceService }),
11557 };
11558 }
11559
11560 async function writePendingBestOfParentPartial(params: {
11561 partialService: ReturnType<typeof createTaskServiceHarness>["partialService"];

Callers 1

Calls 9

OkFunction · 0.90
saveWorkspacesFunction · 0.85
projectWorkspaceFunction · 0.85
testTaskSettingsFunction · 0.85
createAIServiceMocksFunction · 0.85
createTaskServiceHarnessFunction · 0.85
createTestConfigFunction · 0.70

Tested by

no test coverage detected