test(embeddings): fix 6 remaining test failures

- Fix schema.test.ts: use Unix timestamp integers instead of Date objects for snippet_embeddings.createdAt
- Fix embedding.service.test.ts: use 'local-default' profile instead of non-existent 'test-profile', remove require() calls and use proper ESM imports
- Fix hybrid.search.service.test.ts: update VectorSearch.vectorSearch() calls to use options object instead of positional parameters, remove manual FTS insert (triggers handle it automatically)
- Fix migration 0002: improve SQL formatting with line breaks after statement-breakpoint comments

All 459 tests now passing (18 skipped).
This commit is contained in:
Giancarmine Salucci
2026-03-25 19:41:24 +01:00
parent 169df4d984
commit 9519a66cef
4 changed files with 24 additions and 34 deletions

View File

@@ -288,7 +288,7 @@ describe('VectorSearch', () => {
it('returns empty array when no embeddings exist', () => {
const vs = new VectorSearch(client);
const results = vs.vectorSearch(new Float32Array([1, 0]), repoId);
const results = vs.vectorSearch(new Float32Array([1, 0]), { repositoryId: repoId });
expect(results).toHaveLength(0);
});
@@ -306,7 +306,7 @@ describe('VectorSearch', () => {
seedEmbedding(client, s3, [0, 0, 1, 0]);
const vs = new VectorSearch(client);
const results = vs.vectorSearch(new Float32Array([1, 0, 0, 0]), repoId);
const results = vs.vectorSearch(new Float32Array([1, 0, 0, 0]), { repositoryId: repoId });
expect(results[0].snippetId).toBe(s1);
expect(results[0].score).toBeCloseTo(1.0, 4);
@@ -324,7 +324,7 @@ describe('VectorSearch', () => {
}
const vs = new VectorSearch(client);
const results = vs.vectorSearch(new Float32Array([1, 0]), repoId, 3);
const results = vs.vectorSearch(new Float32Array([1, 0]), { repositoryId: repoId, limit: 3 });
expect(results.length).toBeLessThanOrEqual(3);
});
@@ -343,7 +343,7 @@ describe('VectorSearch', () => {
seedEmbedding(client, s2, [1, 0]);
const vs = new VectorSearch(client);
const results = vs.vectorSearch(new Float32Array([1, 0]), repoId);
const results = vs.vectorSearch(new Float32Array([1, 0]), { repositoryId: repoId });
expect(results).toHaveLength(1);
expect(results[0].snippetId).toBe(s1);
@@ -354,7 +354,7 @@ describe('VectorSearch', () => {
seedEmbedding(client, s1, [-0.5, 0.5]);
const vs = new VectorSearch(client);
const results = vs.vectorSearch(new Float32Array([-0.5, 0.5]), repoId);
const results = vs.vectorSearch(new Float32Array([-0.5, 0.5]), { repositoryId: repoId });
expect(results[0].score).toBeCloseTo(1.0, 4);
});
});
@@ -733,11 +733,6 @@ describe('HybridSearchService', () => {
content: 'keyword only test'
});
client.exec(
`INSERT INTO snippets_fts (id, repository_id, version_id, title, breadcrumb, content)
VALUES ('${snippetId}', '${repoId}', NULL, NULL, NULL, 'keyword only test')`
);
let embedCalled = false;
const mockProvider: EmbeddingProvider = {
name: 'mock',