()
| 13 | import type { Memory, CompressedObservation, Session } from "../src/types.js"; |
| 14 | |
| 15 | function mockKV() { |
| 16 | const store = new Map<string, Map<string, unknown>>(); |
| 17 | return { |
| 18 | get: async <T>(scope: string, key: string): Promise<T | null> => { |
| 19 | return (store.get(scope)?.get(key) as T) ?? null; |
| 20 | }, |
| 21 | set: async <T>(scope: string, key: string, data: T): Promise<T> => { |
| 22 | if (!store.has(scope)) store.set(scope, new Map()); |
| 23 | store.get(scope)!.set(key, data); |
| 24 | return data; |
| 25 | }, |
| 26 | delete: async (scope: string, key: string): Promise<void> => { |
| 27 | store.get(scope)?.delete(key); |
| 28 | }, |
| 29 | list: async <T>(scope: string): Promise<T[]> => { |
| 30 | const entries = store.get(scope); |
| 31 | return entries ? (Array.from(entries.values()) as T[]) : []; |
| 32 | }, |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | function mockSdk() { |
| 37 | const functions = new Map<string, Function>(); |
no test coverage detected