Skip to main content
Glama
FullTextSearch.test.tsโ€ข1.39 kB
/** * Unit tests for FullTextSearch */ import { FullTextSearch, DEFAULT_FTS_CONFIG } from "../../search/FullTextSearch.js"; describe("FullTextSearch", () => { describe("Configuration", () => { it("should export default configuration", () => { expect(DEFAULT_FTS_CONFIG).toBeDefined(); expect(DEFAULT_FTS_CONFIG.limit).toBe(10); expect(DEFAULT_FTS_CONFIG.highlightTags).toEqual(["<mark>", "</mark>"]); }); it("should accept configuration in constructor", () => { const mockSQLiteManager = { getDatabase: () => ({ prepare: () => ({ all: () => [] }), }), } as never; const mockStorage = {} as never; const search = new FullTextSearch( mockSQLiteManager, mockStorage, { limit: 20, highlightTags: ["<b>", "</b>"], } ); expect(search).toBeDefined(); }); }); describe("Index Statistics", () => { it("should get index stats", () => { const mockSQLiteManager = { getDatabase: () => ({ prepare: () => ({ get: () => ({ count: 42 }), }), }), } as never; const mockStorage = {} as never; const search = new FullTextSearch(mockSQLiteManager, mockStorage); const stats = search.getIndexStats(); expect(stats.totalChunks).toBe(42); }); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiaolai/claude-writers-aid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server