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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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

Callers 15

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

Calls 3

collectTablesFunction · 0.90
withQueryContextFunction · 0.90
makeLazyTestFumaDbFunction · 0.85

Tested by 15

executorWithConnectionFunction · 0.72
failInvokingFunction · 0.72
setupFunction · 0.68
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