import { describe, it, expect } from 'vitest';
import { rankByRelevance } from '../recall.js';
import type { MemoryEntry } from '../entries.js';

describe('rankByRelevance', () => {
  it('returns entries matching query keywords', () => {
    const entries: MemoryEntry[] = [
      { id: '1', topic: 'project', title: 'Style', content: 'Use two-space indentation', tags: ['style'] },
      { id: '2', topic: 'project', title: 'Tests', content: 'Use vitest for testing', tags: ['testing'] },
    ];
    const result = rankByRelevance('what indentation?', entries);
    expect(result).toHaveLength(1);
    expect(result[0].title).toBe('Style');
  });
});
