fix: resolve ESLint errors and align chromadb types with bundled client

- src/semantic-cache.ts: Replace require('chromadb') with static import and
  use proper ChromaClient/Collection types instead of any. Fix camelCase
  API parameters (queryEmbeddings, nResults) and wrap single embedding into
  Embedding[] for upsert. Fix clearCache to call client.reset() instead of
  collection.reset() (matches actual chromadb API).

- src/workflow-engine/workflow-engine.ts: Fix unnecessary escapes in regex,
  remove redundant 'as unknown' assertion, handle never type in template
  literal, and add type annotations to replace callback to satisfy
  no-unsafe-argument and no-base-to-string rules.

- tests/semantic-cache.test.ts: Update mocks to include client.reset() and
  adjust clearCache assertions to match new implementation.
This commit is contained in:
2026-05-19 20:44:27 +02:00
parent 97cc4ed5fe
commit 1ed2e39c3d
4 changed files with 4764 additions and 5258 deletions
+4 -3
View File
@@ -14,6 +14,7 @@ jest.mock('chromadb', () => ({
reset: jest.fn(),
}),
deleteCollection: jest.fn(),
reset: jest.fn(),
};
}),
IncludeEnum: {
@@ -154,13 +155,13 @@ describe('SemanticCacheService', () => {
await disabledCacheService.clearCache();
expect(mockCollection.reset).not.toHaveBeenCalled();
expect(mockChromaClient.reset).not.toHaveBeenCalled();
});
it('should clear the cache collection', async () => {
it('should clear the cache via the ChromaClient', async () => {
await cacheService.clearCache();
expect(mockCollection.reset).toHaveBeenCalled();
expect(mockChromaClient.reset).toHaveBeenCalled();
});
});
});