Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

858 B
Raw Blame
// @vitest-environment node
import { describe } from 'vitest';

import { getTestDB } from '../../../core/getTestDB';
import type { LobeChatDatabase } from '../../../type';
import { describeFtsSearchFileContentBehavior } from '../__tests__/fileContentBehavior';
import { FtsSearchRepo } from '../index';
import { PgSearchFtsSearchBackend } from './index';

const serverDB: LobeChatDatabase = await getTestDB();

// BM25 retrieval requires the pg_search extension (ParadeDB), not available in PGlite.
describe.skipIf(process.env.TEST_SERVER_DB !== '1')(
  'FtsSearchRepo file content (pg_search)',
  () => {
    describeFtsSearchFileContentBehavior({
      createRepo: (db, userId) =>
        new FtsSearchRepo(db, userId, undefined, undefined, {
          backend: new PgSearchFtsSearchBackend(db, { userId }),
        }),
      db: serverDB,
    });
  },
);