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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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

Callers 15

executorWithConnectionFunction · 0.90
failInvokingFunction · 0.90
oauth-flow.test.tsFile · 0.90
recordToolRowLaunchFunction · 0.85
recordCredentialLaunchFunction · 0.85
executor.test.tsFile · 0.85
makeTestWorkspaceHarnessFunction · 0.85
makeHealthHarnessFunction · 0.85
setupFunction · 0.85

Calls 3

collectTablesFunction · 0.90
withQueryContextFunction · 0.90
makeLazyTestFumaDbFunction · 0.85

Tested by 15

executorWithConnectionFunction · 0.72
failInvokingFunction · 0.72
recordToolRowLaunchFunction · 0.68
recordCredentialLaunchFunction · 0.68
makeHealthHarnessFunction · 0.68
setupFunction · 0.68
makeExecutorFunction · 0.68
makeExecutorWithFunction · 0.68
startMcpHarnessFunction · 0.68
buildExecutorFunction · 0.68
buildExecutorFunction · 0.68
getRegisteredToolSchemaFunction · 0.68