UNPKG

slite-mcp-server

Version:

'Slite MCP server'

43 lines (42 loc) 2.2 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const client_1 = require("../client"); const dotenv_1 = __importDefault(require("dotenv")); // Load environment variables dotenv_1.default.config(); const API_KEY = process.env.SLITE_API_KEY || ''; const BASE_URL = process.env.SLITE_API_URL || 'https://api.slite.com/v1'; (0, vitest_1.describe)('SliteClient', () => { // Integration tests with real API (skip if no API key) (API_KEY ? vitest_1.describe : vitest_1.describe.skip)('SliteClient with real API', () => { let client; (0, vitest_1.beforeEach)(() => { client = new client_1.SliteClient({ apiKey: API_KEY, baseUrl: BASE_URL }); }); (0, vitest_1.it)('should search notes with real API', async () => { const result = await client.search({ query: 'test' }); (0, vitest_1.expect)(Array.isArray(result.results.hits)).toBe(true); }, 10000); (0, vitest_1.it)('should ask questions with real API', async () => { const result = await client.ask({ question: 'Answer fast: what is our VAT number?' }); (0, vitest_1.expect)(typeof result.answer).toBe('string'); (0, vitest_1.expect)(result.answer.length).toBeGreaterThan(0); }, 30000); (0, vitest_1.it)('should get note with real API', async () => { const searchResult = await client.search({ query: '' }); const noteId = searchResult.results.hits[0].id; const result = await client.getNote({ noteId }); (0, vitest_1.expect)(result).toHaveProperty('id'); }, 10000); (0, vitest_1.it)('should get note children with real API', async () => { const searchResult = await client.search({ query: '' }); const noteId = searchResult.results.hits[0].id; const result = await client.getNoteChildren({ noteId }); (0, vitest_1.expect)(Array.isArray(result.notes)).toBe(true); }, 10000); }); });