mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-07 13:22:14 +00:00
test: add unit tests for pinMemory and fix dependency injection in getRelevantMemories
- Add `test/memory-pinning.test.mjs` to test `pinMemory` happy path and edge cases. - Update `getRelevantMemories` in `src/services/memory/index.js` to use `repository.listMemories` when available, enabling isolated unit testing. - Verified all memory tests pass. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
4d11b2b710
commit
a3b181b3d8
2 files changed
+77
-1
No files matched your search
@@ -214,7 +214,11 @@ export async function getRelevantMemories(params) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const ranked = await filterAndRankMemories([...memoryStore.values()], queryParams);
|
||||
const source = typeof repository.listMemories === 'function'
|
||||
? await repository.listMemories(queryParams)
|
||||
: [...memoryStore.values()];
|
||||
|
||||
const ranked = await filterAndRankMemories(source, queryParams);
|
||||
await updateMemoryUsage(repository, ranked.map((memory) => memory.id));
|
||||
cache.set(cacheKey, ranked);
|
||||
|
||||
|
||||
Reference in new issue
Block a user