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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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

Callers 15

makeTestWorkspaceHarnessFunction · 0.85
makeExecutorFunction · 0.85
makeExecutorWithFunction · 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
buildExecutorFunction · 0.68
buildExecutorFunction · 0.68
getRegisteredToolSchemaFunction · 0.68
buildExecutorFunction · 0.68
buildExecutorFunction · 0.68
makeTestExecutorFunction · 0.68
makeCatalogTestExecutorFunction · 0.68
seedCallToolExecutorFunction · 0.68
seedAnnotationsExecutorFunction · 0.68