MCPcopy
hub / github.com/rohitg00/agentmemory / mockSdk

Function mockSdk

test/replay-import-key.test.ts:39–58  ·  view source on GitHub ↗
(kv: ReturnType<typeof mockKV>)

Source from the content-addressed store, hash-verified

37}
38
39function mockSdk(kv: ReturnType<typeof mockKV>) {
40 const fns = new Map<string, Function>();
41 return {
42 registerFunction: (id: string, handler: Function) => fns.set(id, handler),
43 registerTrigger: () => {},
44 trigger: async (
45 idOrInput: string | { function_id: string; payload?: unknown },
46 data?: unknown,
47 ) => {
48 const id =
49 typeof idOrInput === "string" ? idOrInput : idOrInput.function_id;
50 const payload =
51 typeof idOrInput === "string" ? data : (idOrInput as any).payload;
52 const fn = fns.get(id);
53 if (!fn) return { success: true };
54 return fn(payload);
55 },
56 _kv: kv,
57 } as any;
58}
59
60describe("import-jsonl re-key on parsed.sessionId (#775)", () => {
61 let tmpRoot: string;

Callers 1

Calls 2

setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected