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

Function createContext

src/node/orpc/router.test.ts:120–157  ·  view source on GitHub ↗
(options: {
    enabled: boolean;
    workspacePath?: string;
    subProjectPath?: string;
  })

Source from the content-addressed store, hash-verified

118 });
119
120 function createContext(options: {
121 enabled: boolean;
122 workspacePath?: string;
123 subProjectPath?: string;
124 }): ORPCContext {
125 const workspacePath = options.workspacePath ?? projectPath;
126 return {
127 workflowRuntimeFactory: new QuickJSRuntimeFactory(),
128 config,
129 aiService: {
130 waitForInit: mock(async () => undefined),
131 getWorkspaceMetadata: mock(async () => ({
132 success: true,
133 data: {
134 id: "workspace-1",
135 name: "workspace-1",
136 projectPath,
137 namedWorkspacePath: workspacePath,
138 ...(options.subProjectPath != null ? { subProjectPath: options.subProjectPath } : {}),
139 runtimeConfig: { type: "local", srcBaseDir: tempDir },
140 },
141 })),
142 },
143 workspaceService: {
144 emitWorkflowRunActivity: mock(async () => undefined),
145 waitForWorkspaceIdle: mock(async () => undefined),
146 prepareManualWorkflowInvocation: mock(async () => undefined),
147 appendWorkflowRunInvocation: mock(async () => true),
148 isWorkflowInvocationCurrent: mock(async () => false),
149 getWorkflowContinuationSendOptions: mock(() => null),
150 sendMessage: mock(async () => ({ success: true, data: undefined })),
151 },
152 taskService: {},
153 experimentsService: {
154 isExperimentEnabled: mock(() => options.enabled),
155 },
156 } as unknown as ORPCContext;
157 }
158
159 test("interrupts and resumes workflow runs through the API", async () => {
160 const runStore = new WorkflowRunStore({ sessionDir: config.getSessionDir("workspace-1") });

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected