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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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

Callers 15

makeTestWorkspaceHarnessFunction · 0.85
makeExecutorFunction · 0.85
makeExecutorWithFunction · 0.85
startMcpHarnessFunction · 0.85
buildExecutorFunction · 0.85

Calls 3

collectTablesFunction · 0.90
withQueryContextFunction · 0.90
makeLazyTestFumaDbFunction · 0.85

Tested by 15

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
makeCatalogTestExecutorFunction · 0.68
seedCallToolExecutorFunction · 0.68