(kv: ReturnType<typeof mockKV>)
| 37 | } |
| 38 | |
| 39 | function 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 | |
| 60 | describe("import-jsonl re-key on parsed.sessionId (#775)", () => { |
| 61 | let tmpRoot: string; |
no test coverage detected