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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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

Callers 15

executorWithConnectionFunction · 0.90
failInvokingFunction · 0.90
makeTestWorkspaceHarnessFunction · 0.85
makeExecutorFunction · 0.85
makeExecutorWithFunction · 0.85

Calls 3

collectTablesFunction · 0.90
withQueryContextFunction · 0.90
makeLazyTestFumaDbFunction · 0.85

Tested by 15

executorWithConnectionFunction · 0.72
failInvokingFunction · 0.72
makeExecutorFunction · 0.68
makeExecutorWithFunction · 0.68
startMcpHarnessFunction · 0.68
buildExecutorFunction · 0.68
buildExecutorFunction · 0.68
getRegisteredToolSchemaFunction · 0.68
buildExecutorFunction · 0.68
buildExecutorFunction · 0.68
makeTestExecutorFunction · 0.68