MCPcopy
hub / github.com/cita-777/metapi / createStubClient

Function createStubClient

src/server/db/runtimeSchemaBootstrap.test.ts:14–38  ·  view source on GitHub ↗
(dialect: RuntimeSchemaDialect, executedSql: string[])

Source from the content-addressed store, hash-verified

12} from './runtimeSchemaBootstrap.js';
13
14function createStubClient(dialect: RuntimeSchemaDialect, executedSql: string[]): RuntimeSchemaClient {
15 return {
16 dialect,
17 begin: async () => {},
18 commit: async () => {},
19 rollback: async () => {},
20 execute: async (sqlText: string) => {
21 if (sqlText.trim().toLowerCase().startsWith('select')) {
22 return [];
23 }
24 executedSql.push(sqlText);
25 return [];
26 },
27 queryScalar: async (sqlText: string, params: unknown[] = []) => {
28 if (sqlText.includes('information_schema') || sqlText.includes('sqlite_master') || sqlText.includes('pragma_table_info')) {
29 return 1;
30 }
31 if (params.length > 0) {
32 return 1;
33 }
34 return 0;
35 },
36 close: async () => {},
37 };
38}
39
40function makeColumn(overrides: Partial<SchemaContractColumn> = {}): SchemaContractColumn {
41 return {

Callers 1

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected