MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / makeTestConfig

Function makeTestConfig

packages/core/sdk/src/test-config.ts:139–180  ·  view source on GitHub ↗
(
  options?: TestConfigOptions<TPlugins>,
)

Source from the content-addressed store, hash-verified

137};
138
139export const makeTestConfig = <const TPlugins extends readonly AnyPlugin[] = readonly []>(
140 options?: TestConfigOptions<TPlugins>,
141): Omit<ExecutorConfig<TPlugins>, "db"> & {
142 readonly db: FumaDb;
143 readonly testDb: TestFumaDb;
144} => {
145 const tenant = options?.tenant ?? "test-tenant";
146 const subject = options?.subject === undefined ? "test-subject" : options.subject;
147
148 const tables = collectTables();
149 const testDb = makeLazyTestFumaDb({
150 tables,
151 backend: options?.backend ?? "sqlite",
152 dataDir: options?.dataDir,
153 });
154 const db = withQueryContext(testDb.db, {
155 tenant,
156 subject,
157 } satisfies ExecutorOwnerPolicyContext);
158
159 // EXPLICIT OAuth callback: default to a stable test URL so the redirect flow
160 // tests work without the removed localhost default; `redirectUri: null` omits
161 // it so a test can exercise the fail-loud "no callback configured" path.
162 const redirectUri =
163 options?.redirectUri === undefined ? TEST_OAUTH_REDIRECT_URI : options.redirectUri;
164
165 return {
166 tenant: Tenant.make(tenant),
167 ...(subject != null ? { subject: Subject.make(subject) } : {}),
168 db,
169 plugins: options?.plugins,
170 coreTools: options?.coreTools,
171 testDb,
172 // Tests default to auto-accepting elicitation prompts.
173 onElicitation: "accept-all",
174 onIntegrationChange: options?.onIntegrationChange,
175 ...(redirectUri != null ? { redirectUri } : {}),
176 oauthCallbackStateOrgSlug: options?.oauthCallbackStateOrgSlug,
177 firstPartyOAuthClients: options?.firstPartyOAuthClients,
178 enterpriseManagedRollout: options?.enterpriseManagedRollout,
179 };
180};
181
182export interface TestWorkspaceHarness<
183 TPlugins extends readonly AnyPlugin[] = readonly AnyPlugin[],

Callers 15

executorWithConnectionFunction · 0.90
failInvokingFunction · 0.90
oauth-flow.test.tsFile · 0.90
makeTestWorkspaceHarnessFunction · 0.85
makeHealthHarnessFunction · 0.85
makeExecutorFunction · 0.85

Calls 3

collectTablesFunction · 0.90
withQueryContextFunction · 0.90
makeLazyTestFumaDbFunction · 0.85

Tested by 15

executorWithConnectionFunction · 0.72
failInvokingFunction · 0.72
makeHealthHarnessFunction · 0.68
makeExecutorFunction · 0.68
makeExecutorWithFunction · 0.68
startMcpHarnessFunction · 0.68
buildExecutorFunction · 0.68
buildExecutorFunction · 0.68
getRegisteredToolSchemaFunction · 0.68
buildExecutorFunction · 0.68
withProbeFunction · 0.68
buildExecutorFunction · 0.68