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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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