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

Function makeTestConfig

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

Source from the content-addressed store, hash-verified

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