mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-05 08:06:02 +00:00
- 59 test files covering unit and integration tests - vitest config with coverage thresholds and fork pooling - Test fixtures (mini-repo + multi-language sample code) - Add vitest + coverage-v8 to devDependencies - Add test scripts (test, test:integration, test:all, test:watch, test:coverage) - Move typescript to devDependencies where it belongs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { searchFTSFromKuzu, type BM25SearchResult } from '../../src/core/search/bm25-index.js';
|
|
|
|
describe('BM25 search', () => {
|
|
describe('searchFTSFromKuzu', () => {
|
|
it('returns empty array when KuzuDB is not initialized', async () => {
|
|
// Without KuzuDB init, search should return empty (not crash)
|
|
const results = await searchFTSFromKuzu('test query');
|
|
expect(Array.isArray(results)).toBe(true);
|
|
expect(results).toHaveLength(0);
|
|
});
|
|
|
|
it('handles empty query', async () => {
|
|
const results = await searchFTSFromKuzu('');
|
|
expect(Array.isArray(results)).toBe(true);
|
|
});
|
|
|
|
it('accepts custom limit parameter', async () => {
|
|
const results = await searchFTSFromKuzu('test', 5);
|
|
expect(Array.isArray(results)).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('BM25SearchResult type', () => {
|
|
it('has correct shape', () => {
|
|
const result: BM25SearchResult = {
|
|
filePath: 'src/index.ts',
|
|
score: 1.5,
|
|
rank: 1,
|
|
};
|
|
expect(result.filePath).toBe('src/index.ts');
|
|
expect(result.score).toBe(1.5);
|
|
expect(result.rank).toBe(1);
|
|
});
|
|
});
|
|
});
|